[Fix] Error in sales invoice and POS if customer group not defined in the customer (#10160)

This commit is contained in:
rohitwaghchaure
2017-07-28 20:52:02 +05:30
committed by Nabin Hait
parent 9d5b1b0e8f
commit e2176b852e
9 changed files with 221 additions and 71 deletions

View File

@@ -273,6 +273,7 @@ def get_due_date(posting_date, party_type, party, company):
return due_date
def get_credit_days(party_type, party, company):
credit_days = 0
if party_type and party:
if party_type == "Customer":
credit_days_based_on, credit_days, customer_group = \
@@ -282,10 +283,10 @@ def get_credit_days(party_type, party, company):
frappe.db.get_value(party_type, party, ["credit_days_based_on", "credit_days", "supplier_type"])
if not credit_days_based_on:
if party_type == "Customer":
if party_type == "Customer" and customer_group:
credit_days_based_on, credit_days = \
frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"])
else:
elif party_type == "Supplier" and supplier_type:
credit_days_based_on, credit_days = \
frappe.db.get_value("Supplier Type", supplier_type, ["credit_days_based_on", "credit_days"])