[minor] added cache in get_value
This commit is contained in:
parent
8be3ba36d9
commit
50ce9753e0
@ -348,8 +348,8 @@ def get_actual_expense(args):
|
||||
def get_currency_precision(currency=None):
|
||||
if not currency:
|
||||
currency = frappe.db.get_value("Company",
|
||||
frappe.db.get_default("company"), "default_currency")
|
||||
currency_format = frappe.db.get_value("Currency", currency, "number_format")
|
||||
frappe.db.get_default("company"), "default_currency", cache=True)
|
||||
currency_format = frappe.db.get_value("Currency", currency, "number_format", cache=True)
|
||||
|
||||
from frappe.utils import get_number_format_info
|
||||
return get_number_format_info(currency_format)[2]
|
||||
|
@ -358,7 +358,7 @@ def get_taxes_and_charges(master_doctype, master_name, tax_parentfield):
|
||||
def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
|
||||
"""common validation for currency and price list currency"""
|
||||
|
||||
company_currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
company_currency = frappe.db.get_value("Company", company, "default_currency", cache=True)
|
||||
|
||||
if not conversion_rate:
|
||||
throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format(
|
||||
|
@ -7,7 +7,7 @@ from frappe import _, throw
|
||||
from frappe.utils import flt
|
||||
|
||||
def get_company_currency(company):
|
||||
currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
currency = frappe.db.get_value("Company", company, "default_currency", cache=True)
|
||||
if not currency:
|
||||
currency = frappe.db.get_default("currency")
|
||||
if not currency:
|
||||
|
@ -98,7 +98,7 @@ class update_entries_after(object):
|
||||
|
||||
self.company = frappe.db.get_value("Warehouse", self.warehouse, "company")
|
||||
self.precision = get_field_precision(frappe.get_meta("Stock Ledger Entry").get_field("stock_value"),
|
||||
currency=frappe.db.get_value("Company", self.company, "default_currency"))
|
||||
currency=frappe.db.get_value("Company", self.company, "default_currency", cache=True))
|
||||
|
||||
self.prev_stock_value = self.previous_sle.stock_value or 0.0
|
||||
self.stock_queue = json.loads(self.previous_sle.stock_queue or "[]")
|
||||
|
Loading…
x
Reference in New Issue
Block a user