mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-19 10:14:59 +00:00
perf: Caching in gl entry
This commit is contained in:
@@ -159,7 +159,7 @@ class GLEntry(Document):
|
|||||||
def check_pl_account(self):
|
def check_pl_account(self):
|
||||||
if (
|
if (
|
||||||
self.is_opening == "Yes"
|
self.is_opening == "Yes"
|
||||||
and frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss"
|
and frappe.get_cached_value("Account", self.account, "report_type") == "Profit and Loss"
|
||||||
and not self.is_cancelled
|
and not self.is_cancelled
|
||||||
):
|
):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
@@ -279,7 +279,7 @@ def update_outstanding_amt(
|
|||||||
party_condition = ""
|
party_condition = ""
|
||||||
|
|
||||||
if against_voucher_type == "Sales Invoice":
|
if against_voucher_type == "Sales Invoice":
|
||||||
party_account = frappe.db.get_value(against_voucher_type, against_voucher, "debit_to")
|
party_account = frappe.get_cached_value(against_voucher_type, against_voucher, "debit_to")
|
||||||
account_condition = "and account in ({0}, {1})".format(
|
account_condition = "and account in ({0}, {1})".format(
|
||||||
frappe.db.escape(account), frappe.db.escape(party_account)
|
frappe.db.escape(account), frappe.db.escape(party_account)
|
||||||
)
|
)
|
||||||
@@ -347,7 +347,7 @@ def update_outstanding_amt(
|
|||||||
def validate_frozen_account(account, adv_adj=None):
|
def validate_frozen_account(account, adv_adj=None):
|
||||||
frozen_account = frappe.get_cached_value("Account", account, "freeze_account")
|
frozen_account = frappe.get_cached_value("Account", account, "freeze_account")
|
||||||
if frozen_account == "Yes" and not adv_adj:
|
if frozen_account == "Yes" and not adv_adj:
|
||||||
frozen_accounts_modifier = frappe.db.get_value(
|
frozen_accounts_modifier = frappe.get_cached_value(
|
||||||
"Accounts Settings", None, "frozen_accounts_modifier"
|
"Accounts Settings", None, "frozen_accounts_modifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user