Merge pull request #36821 from mendozal/fix-currency-precision-js
This commit is contained in:
commit
cd928fabd5
2 changed files with 8 additions and 1 deletions
|
|
@ -894,6 +894,12 @@ def get_field_currency(df, doc=None):
|
|||
if frappe.get_meta(doc.parenttype).has_field(df.get("options")):
|
||||
# only get_value if parent has currency field
|
||||
currency = frappe.db.get_value(doc.parenttype, doc.parent, df.get("options"))
|
||||
if not currency:
|
||||
# Parent may not be in DB yet (new document being saved).
|
||||
# Use the in-memory parent document reference if available.
|
||||
parent = getattr(doc, "parent_doc", None)
|
||||
if parent:
|
||||
currency = parent.get(df.get("options"))
|
||||
|
||||
if currency:
|
||||
frappe.local.field_currency.setdefault((doc.doctype, ref_docname), frappe._dict()).setdefault(
|
||||
|
|
|
|||
|
|
@ -332,7 +332,8 @@ $.extend(frappe.meta, {
|
|||
} else if (df && df.fieldtype === "Currency") {
|
||||
precision = cint(frappe.defaults.get_default("currency_precision"));
|
||||
if (!precision) {
|
||||
var number_format = get_number_format();
|
||||
var currency = frappe.meta.get_field_currency(df, doc);
|
||||
var number_format = get_number_format(currency);
|
||||
var number_format_info = get_number_format_info(number_format);
|
||||
precision = number_format_info.precision;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue