Merge pull request #38461 from rohitwaghchaure/fixed-do_not_round_fields

feat: do not round fields
This commit is contained in:
rohitwaghchaure 2026-04-07 17:24:16 +05:30 committed by GitHub
commit b80b121f51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(