From 323bce4f8909294fcf0c1901f395db287cb573a0 Mon Sep 17 00:00:00 2001 From: Yolann Sabaux Date: Wed, 7 Jun 2023 07:00:36 +0000 Subject: [PATCH] [FIX] account: apply constraint only on add line strategy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR added a constraint https://github.com/odoo/odoo/pull/120892 This constraint should only be applied on `add_invoice_line` cash rounding strategy. Initial opw-3185950 closes odoo/odoo#124289 X-original-commit: 02183ef878f8809032892338c41cc8816cab9669 Signed-off-by: William André (wan) Signed-off-by: Yolann Sabaux (yosa) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index c1db0e5a903..0552636c84f 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1715,7 +1715,7 @@ class AccountMove(models.Model): @api.onchange('invoice_cash_rounding_id') def _onchange_invoice_cash_rounding_id(self): for move in self: - if move.invoice_cash_rounding_id and not move.invoice_cash_rounding_id.profit_account_id: + if move.invoice_cash_rounding_id.strategy == 'add_invoice_line' and not move.invoice_cash_rounding_id.profit_account_id: return {'warning': { 'title': _("Warning for Cash Rounding Method: %s", move.invoice_cash_rounding_id.name), 'message': _("You must specifiy the Profit Account (company dependent)")