From eca2ec13284468334f9ef4f0916ca03b0f784ab8 Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Fri, 22 Mar 2024 10:42:34 +0100 Subject: [PATCH] [FIX] point_of_sale: prevent unbalanced error for invoicing cash orders Before this commit, attempting to invoice an order paid by cash in a new session, with cash rounding enabled only for cash payments in the PoS config, would result in an unbalanced entries error. opw-3813932 closes odoo/odoo#158907 X-original-commit: 3a61e143af62f1edeec299a39ab133138ec0560c Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/models/pos_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 94e75303eff..391ae4cebde 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -735,7 +735,7 @@ class PosOrder(models.Model): # Cash rounding. cash_rounding = self.config_id.rounding_method - if self.config_id.cash_rounding and cash_rounding and not self.config_id.only_round_cash_method: + if self.config_id.cash_rounding and cash_rounding and (not self.config_id.only_round_cash_method or any(p.payment_method_id.is_cash_count for p in self.payment_ids)): amount_currency = cash_rounding.compute_difference(self.currency_id, total_amount_currency) if not self.currency_id.is_zero(amount_currency): balance = company_currency.round(amount_currency * rate)