[FIX] account: error on analytic distribution change

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) <wan@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2024-02-01 09:49:58 +00:00
parent 01d7998507
commit 7ef704830f
@@ -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([