[FIX] account: apply constraint only on add line strategy

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) <wan@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
This commit is contained in:
Yolann Sabaux
2023-06-08 17:40:29 +02:00
parent 33ebfd68a0
commit 323bce4f89
+1 -1
View File
@@ -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)")