[fix] [minor] pull credit days from customer, update credit days in account of customer
This commit is contained in:
parent
47e14a9de4
commit
dd2ec17962
@ -250,10 +250,15 @@ class DocType(SellingController):
|
||||
|
||||
def get_cust_and_due_date(self):
|
||||
"""Set Due Date = Posting Date + Credit Days"""
|
||||
if self.doc.debit_to:
|
||||
self.doc.customer = webnotes.conn.get_value('Account', self.doc.debit_to, 'master_name')
|
||||
|
||||
if self.doc.posting_date:
|
||||
credit_days = 0
|
||||
if self.doc.debit_to:
|
||||
credit_days = webnotes.conn.get_value("Account", self.doc.debit_to, "credit_days")
|
||||
if self.doc.customer and not credit_days:
|
||||
credit_days = webnotes.conn.get_value("Customer", self.doc.customer, "credit_days")
|
||||
if self.doc.company and not credit_days:
|
||||
credit_days = webnotes.conn.get_value("Company", self.doc.company, "credit_days")
|
||||
|
||||
@ -261,9 +266,6 @@ class DocType(SellingController):
|
||||
self.doc.due_date = add_days(self.doc.posting_date, credit_days)
|
||||
else:
|
||||
self.doc.due_date = self.doc.posting_date
|
||||
|
||||
if self.doc.debit_to:
|
||||
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
|
||||
|
||||
def get_barcode_details(self, barcode):
|
||||
return get_obj('Sales Common').get_barcode_details(barcode)
|
||||
|
@ -77,9 +77,9 @@ class DocType(TransactionBase):
|
||||
msgprint("Please Select Company under which you want to create account head")
|
||||
|
||||
def update_credit_days_limit(self):
|
||||
sql("""update tabAccount set credit_days = %s, credit_limit = %s
|
||||
where name = %s""", (self.doc.credit_days or 0, self.doc.credit_limit or 0,
|
||||
self.doc.name + " - " + self.get_company_abbr()))
|
||||
webnotes.conn.sql("""update tabAccount set credit_days = %s, credit_limit = %s
|
||||
where master_type='Customer' and master_name = %s""",
|
||||
(self.doc.credit_days or 0, self.doc.credit_limit or 0, self.doc.name))
|
||||
|
||||
def create_lead_address_contact(self):
|
||||
if self.doc.lead_name:
|
||||
|
Loading…
Reference in New Issue
Block a user