fix: tolerate floating-point drift in sales team allocated percentage

the total of allocated_percentage was compared to 100 with exact float
equality, so a correct allocation could be rejected when the sum drifts
in binary floating point (10.0 + 58.02 + 31.98 -> 100.00000000000001).

round the total to the field precision before comparing, in both
SellingController.calculate_contribution and Customer.validate.
This commit is contained in:
pandiyan
2026-08-09 11:25:12 +05:30
parent 529a003ed1
commit f7b2775829
2 changed files with 3 additions and 2 deletions

View File

@@ -254,7 +254,7 @@ class SellingController(StockController):
total += sales_person.allocated_percentage
if sales_team and total != 100.0:
if sales_team and flt(total, self.precision("allocated_percentage", "sales_team")) != 100.0:
throw(_("Total allocated percentage for sales team should be 100"))
def validate_sales_team(self, sales_team):