[fix] Get field precision for currency field
This commit is contained in:
parent
60572affbf
commit
546ad3e453
2 changed files with 9 additions and 6 deletions
|
|
@ -150,7 +150,6 @@ function get_currency_symbol(currency) {
|
|||
}
|
||||
}
|
||||
|
||||
var global_number_format = null;
|
||||
function get_number_format(currency) {
|
||||
return (frappe.boot && frappe.boot.sysdefaults.number_format) || "#,###.##";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,14 +250,18 @@ $.extend(frappe.meta, {
|
|||
},
|
||||
|
||||
get_field_precision: function(df, doc) {
|
||||
var precision = cint(frappe.defaults.get_default("float_precision")) || 3;
|
||||
var precision = null;
|
||||
if (df && cint(df.precision)) {
|
||||
precision = cint(df.precision);
|
||||
} else if(df && df.fieldtype === "Currency") {
|
||||
var currency = this.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;
|
||||
precision = cint(frappe.defaults.get_default("currency_precision"));
|
||||
if(!precision) {
|
||||
var number_format = get_number_format();
|
||||
var number_format_info = get_number_format_info(number_format);
|
||||
precision = number_format_info.precision;
|
||||
}
|
||||
} else {
|
||||
precision = cint(frappe.defaults.get_default("float_precision")) || 3;
|
||||
}
|
||||
return precision;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue