diff --git a/india_compliance/gst_india/utils/transaction_data.py b/india_compliance/gst_india/utils/transaction_data.py index 5101af16dd..a176e27337 100644 --- a/india_compliance/gst_india/utils/transaction_data.py +++ b/india_compliance/gst_india/utils/transaction_data.py @@ -87,10 +87,17 @@ def update_transaction_tax_details(self): for total in ["base_total", "rounding_adjustment", *tax_totals]: current_total += self.transaction_details.get(total) - self.transaction_details.other_charges = self.rounded( + other_charges = self.rounded( (self.transaction_details.base_grand_total - current_total) ) + if 0 < other_charges < -0.1: + # other charges cannot be negative + # handle cases where user has higher precision than 2 + self.transaction_details.rounding_adjustment += other_charges + else: + self.transaction_details.other_charges = other_charges + def validate_mode_of_transport(self, throw=True): def _throw(error): if throw: