perf: reduce queries during transaction save

(cherry picked from commit b6b8a06fda)
This commit is contained in:
Sagar Vora
2024-11-30 00:11:03 +05:30
committed by Mergify
parent 0199bc127a
commit 48059a7c74
3 changed files with 13 additions and 19 deletions

View File

@@ -74,19 +74,13 @@ class SellingController(StockController):
if customer:
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(
customer,
ignore_permissions=self.flags.ignore_permissions,
doctype=self.doctype,
company=self.company,
posting_date=self.get("posting_date"),
fetch_payment_terms_template=fetch_payment_terms_template,
fetch_payment_terms_template=self.has_value_changed("company"),
party_address=self.customer_address,
shipping_address=self.shipping_address_name,
company_address=self.get("company_address"),