From 7ef704830ff1e1a206962fb10ae667caeefbedd4 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 30 Jan 2024 11:48:09 +0100 Subject: [PATCH] [FIX] account: error on analytic distribution change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install Studio Activate form view of journal items and disable readonly flag on Analytic distribution field. Create a journal entry adding analytic distribution to a line and post. Now open the journal item in form view and try to change the analytic distribution Action will be blocked by error This is caused by the onchange in _inverse_analytic_distribution. As the method take care of unlinking and creating new lines no more actions are required by the orm opw-3690346 closes odoo/odoo#152143 X-original-commit: 89ef4ae17a507007855ce21e166bec82fc25bd93 Signed-off-by: William André (wan) Signed-off-by: Andrea Grazioso (agr) --- addons/account/models/account_move_line.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 5a6d497fb08..bab8c89f37c 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -1203,7 +1203,6 @@ class AccountMoveLine(models.Model): line.debit = 0 line.balance = line.debit - line.credit - @api.onchange('analytic_distribution') def _inverse_analytic_distribution(self): """ Unlink and recreate analytic_lines when modifying the distribution.""" lines_to_modify = self.env['account.move.line'].browse([