fixes in validattion of debit to account with customer in sales invoice

This commit is contained in:
Nabin Hait 2012-05-01 10:53:50 +05:30
parent 41c62727c7
commit 1e335f3272

View File

@ -314,7 +314,7 @@ class DocType(TransactionBase):
# ------------------------------------------------ # ------------------------------------------------
def validate_debit_to_acc(self): def validate_debit_to_acc(self):
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos): if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
acc_head = sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to) acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \ if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())): (not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):