fix: payment entry voucher_type error (#35779)

* fix: payment entry `voucher_type` error (#35779)

* fix: payment entry `voucher_type` error

* chore: linters

(cherry picked from commit 361a357088)

# Conflicts:
#	erpnext/accounts/doctype/payment_entry/payment_entry.py

* chore: resolve conflicts

---------

Co-authored-by: Dany Robert <danyrt@wahni.com>
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
This commit is contained in:
mergify[bot]
2023-07-11 10:19:55 +05:30
committed by GitHub
parent 06c85fa252
commit 9c3ec41803

View File

@@ -1336,6 +1336,9 @@ def get_outstanding_reference_documents(args):
if args.get("party_type") == "Member": if args.get("party_type") == "Member":
return return
if not args.get("get_outstanding_invoices") and not args.get("get_orders_to_be_billed"):
args["get_outstanding_invoices"] = True
# confirm that Supplier is not blocked # confirm that Supplier is not blocked
if args.get("party_type") == "Supplier": if args.get("party_type") == "Supplier":
supplier_status = get_supplier_block_status(args["party"]) supplier_status = get_supplier_block_status(args["party"])
@@ -1517,22 +1520,21 @@ def get_orders_to_be_billed(
cost_center=None, cost_center=None,
filters=None, filters=None,
): ):
voucher_type = None
if party_type == "Customer": if party_type == "Customer":
voucher_type = "Sales Order" voucher_type = "Sales Order"
elif party_type == "Supplier": elif party_type == "Supplier":
voucher_type = "Purchase Order" voucher_type = "Purchase Order"
elif party_type == "Employee":
voucher_type = None if not voucher_type:
return []
# Add cost center condition # Add cost center condition
if voucher_type:
doc = frappe.get_doc({"doctype": voucher_type}) doc = frappe.get_doc({"doctype": voucher_type})
condition = "" condition = ""
if doc and hasattr(doc, "cost_center") and doc.cost_center: if doc and hasattr(doc, "cost_center") and doc.cost_center:
condition = " and cost_center='%s'" % cost_center condition = " and cost_center='%s'" % cost_center
orders = []
if voucher_type:
if party_account_currency == company_currency: if party_account_currency == company_currency:
grand_total_field = "base_grand_total" grand_total_field = "base_grand_total"
rounded_total_field = "base_rounded_total" rounded_total_field = "base_rounded_total"
@@ -1603,6 +1605,8 @@ def get_negative_outstanding_invoices(
cost_center=None, cost_center=None,
condition=None, condition=None,
): ):
if party_type not in ["Customer", "Supplier"]:
return []
voucher_type = "Sales Invoice" if party_type == "Customer" else "Purchase Invoice" voucher_type = "Sales Invoice" if party_type == "Customer" else "Purchase Invoice"
supplier_condition = "" supplier_condition = ""
if voucher_type == "Purchase Invoice": if voucher_type == "Purchase Invoice":