[fix] correctly choice 'Credit Limit' (#9932)
* [fix] correctly choice 'credit limit'
If 'Credit Days Based On' is empty in 'Supplier Type/Customer Group' then value 'Due Date' in 'Purchase/Sales Invoice' doesn't taken from the default settings
* Update party.py
* [fix] correctly choice 'Credit Limit'
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index bf509de..b88623b 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -284,12 +284,14 @@
if not credit_days_based_on:
if party_type == "Customer":
credit_days_based_on, credit_days = \
- frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"]) \
- or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"])
+ frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"])
else:
credit_days_based_on, credit_days = \
- frappe.db.get_value("Supplier Type", supplier_type, ["credit_days_based_on", "credit_days"])\
- or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"] )
+ frappe.db.get_value("Supplier Type", supplier_type, ["credit_days_based_on", "credit_days"])
+
+ if not (credit_days_based_on and credit_days):
+ credit_days_based_on, credit_days = \
+ frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"])
return credit_days_based_on, credit_days