[minor] [fix] precision for float fields on server-side
This commit is contained in:
parent
f5727e4834
commit
a7cf1df5a9
3 changed files with 9 additions and 6 deletions
|
|
@ -26,7 +26,7 @@ $(cur_frm.wrapper).on("grid-row-render", function(e, grid_row) {
|
|||
}
|
||||
})
|
||||
|
||||
cur_frm.cscript.doc_type = function(doc, dt, dn) {
|
||||
cur_frm.cscript.doc_type = function() {
|
||||
return cur_frm.call({
|
||||
method: "get",
|
||||
doc: cur_frm.doc,
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ window.format_number = function(v, format, decimals){
|
|||
return (is_negative ? "-" : "") + part[0] + part[1];
|
||||
};
|
||||
|
||||
function format_currency(v, currency) {
|
||||
function format_currency(v, currency, decimals) {
|
||||
var format = get_number_format(currency);
|
||||
var symbol = get_currency_symbol(currency);
|
||||
|
||||
if(symbol)
|
||||
return symbol + " " + format_number(v, format);
|
||||
return symbol + " " + format_number(v, format, decimals);
|
||||
else
|
||||
return format_number(v, format);
|
||||
return format_number(v, format, decimals);
|
||||
}
|
||||
|
||||
function get_currency_symbol(currency) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,10 @@ class DocListController(object):
|
|||
if df.fieldtype == "Currency" and df.options and not self._precision.options.get(df.options):
|
||||
self._precision.options[df.options] = get_field_precision(df, self.doc)
|
||||
|
||||
self._precision[parentfield or "main"][fieldname] = cint(self._precision.options.get(df.options)) or \
|
||||
self._precision.default
|
||||
if df.fieldtype == "Currency":
|
||||
self._precision[parentfield or "main"][fieldname] = cint(self._precision.options.get(df.options)) or \
|
||||
self._precision.default
|
||||
elif df.fieldtype == "Float":
|
||||
self._precision[parentfield or "main"][fieldname] = self._precision.default
|
||||
|
||||
return self._precision[parentfield or "main"][fieldname]
|
||||
Loading…
Add table
Reference in a new issue