Update sales_invoice.py
This commit is contained in:
parent
5b3b123fe8
commit
de79aaa131
@ -433,15 +433,15 @@ class DocType(SellingController):
|
|||||||
from accounts.utils import reconcile_against_document
|
from accounts.utils import reconcile_against_document
|
||||||
reconcile_against_document(lst)
|
reconcile_against_document(lst)
|
||||||
|
|
||||||
def validate_customer(self):
|
def validate_customer_account(self):
|
||||||
""" Validate customer name with SO and DN"""
|
"""Validates Debit To Account and Customer Matches"""
|
||||||
for d in getlist(self.doclist,'entries'):
|
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
||||||
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
|
acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
|
||||||
if dt:
|
|
||||||
dt_no = d.delivery_note or d.sales_order
|
if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
|
||||||
cust = webnotes.conn.sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
|
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
|
||||||
if cust and cstr(cust[0][0]) != cstr(self.doc.customer):
|
msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
|
||||||
msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
|
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
def validate_customer(self):
|
def validate_customer(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user