[Fix] System always fetches the payment terms template from the company even if it's removed from the sales invoice (#14879)

This commit is contained in:
rohitwaghchaure
2018-07-13 17:40:48 +05:30
committed by Nabin Hait
parent 5c3b69476d
commit 3ffe89659a
3 changed files with 24 additions and 11 deletions

View File

@@ -52,9 +52,15 @@ class SellingController(StockController):
def set_missing_lead_customer_details(self):
if getattr(self, "customer", None):
from erpnext.accounts.party import _get_party_details
fetch_payment_terms_template = False
if (self.get("__islocal") or
self.company != frappe.db.get_value(self.doctype, self.name, 'company')):
fetch_payment_terms_template = True
party_details = _get_party_details(self.customer,
ignore_permissions=self.flags.ignore_permissions,
doctype=self.doctype, company=self.company)
doctype=self.doctype, company=self.company,
fetch_payment_terms_template=fetch_payment_terms_template)
if not self.meta.get_field("sales_team"):
party_details.pop("sales_team")