From 7b9c7bc9a905f5e2f048c8abc443a74e8a0bd4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Thu, 10 Oct 2024 09:04:24 +0200 Subject: [PATCH] [IMP]pms: folio_sale_line compare float value round in invoiced folios --- pms/models/folio_sale_line.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pms/models/folio_sale_line.py b/pms/models/folio_sale_line.py index c8c87e7bf6..4b8eecd303 100644 --- a/pms/models/folio_sale_line.py +++ b/pms/models/folio_sale_line.py @@ -991,9 +991,14 @@ def write(self, values): ) ) # We check that dont modified the protected fields in locked folios + # if field is float, we need to round it to compare with the original value if self.filtered( lambda l: any( - values.get(field.name) != getattr(l, field.name) + round(values.get(field.name), 2) + != round(getattr(l, field.name), 2) + if isinstance(values.get(field.name), float) + and isinstance(getattr(l, field.name), float) + else values.get(field.name) != getattr(l, field.name) for field in fields_modified ) ):