[fix] [minor] if customer_account is mentioned in POS Settings, also fetch customer_name

This commit is contained in:
Anand Doshi 2013-07-29 19:53:44 +05:30
parent 1f996c3121
commit f90df7da02
2 changed files with 8 additions and 2 deletions

View File

@ -174,8 +174,8 @@ class DocType(SellingController):
self.convert_to_recurring()
def set_missing_values(self, for_validate=False):
super(DocType, self).set_missing_values(for_validate)
self.set_pos_fields(for_validate)
super(DocType, self).set_missing_values(for_validate)
def set_customer_defaults(self):
# TODO cleanup these methods
@ -216,6 +216,12 @@ class DocType(SellingController):
"docstatus": ["!=", 2]
}) or pos.customer_account
if self.doc.debit_to and not self.doc.customer:
self.doc.customer = webnotes.conn.get_value("Account", {
"name": self.doc.debit_to,
"master_type": "Customer"
}, "master_name")
for fieldname in ('territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
'price_list_name', 'company', 'select_print_heading', 'cash_bank_account'):
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):