feat: do not round fields
This commit is contained in:
parent
b274d2ba11
commit
1c47e262ae
1 changed files with 4 additions and 1 deletions
|
|
@ -1766,7 +1766,7 @@ class Document(BaseDocument):
|
|||
_("Table {0} cannot be empty").format(label), raise_exception or frappe.EmptyTableError
|
||||
)
|
||||
|
||||
def round_floats_in(self, doc, fieldnames=None):
|
||||
def round_floats_in(self, doc, fieldnames=None, do_not_round_fields=None):
|
||||
"""Round floats for all `Currency`, `Float`, `Percent` fields for the given doc.
|
||||
|
||||
:param doc: Document whose numeric properties are to be rounded.
|
||||
|
|
@ -1780,6 +1780,9 @@ class Document(BaseDocument):
|
|||
# PERF: flt internally has to resolve this if we don't specify it.
|
||||
rounding_method = frappe.get_system_settings("rounding_method")
|
||||
for fieldname in fieldnames:
|
||||
if do_not_round_fields and fieldname in do_not_round_fields:
|
||||
continue
|
||||
|
||||
doc.set(
|
||||
fieldname,
|
||||
flt(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue