Set default only if customer_address not found (#15605)

* Set default only if customer_address not found

* Similar fix for Purchase Invoice and shipping_address
This commit is contained in:
Shreya Shah
2018-10-07 11:42:07 +05:30
committed by Nabin Hait
parent e7e269d4a4
commit 5615cb4735
3 changed files with 13 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ class SellingController(StockController):
set_default_income_account_for_item(self)
def set_missing_values(self, for_validate=False):
super(SellingController, self).set_missing_values(for_validate)
# set contact and address details for customer, if they are not mentioned
@@ -61,10 +62,10 @@ class SellingController(StockController):
party_details = _get_party_details(self.customer,
ignore_permissions=self.flags.ignore_permissions,
doctype=self.doctype, company=self.company,
fetch_payment_terms_template=fetch_payment_terms_template)
fetch_payment_terms_template=fetch_payment_terms_template,
party_address=self.customer_address, shipping_address=self.shipping_address)
if not self.meta.get_field("sales_team"):
party_details.pop("sales_team")
self.update_if_missing(party_details)
elif getattr(self, "lead", None):