From 284c5ba50d4f3eba622b0844e5ebfa67bea008a9 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 19 Mar 2018 17:43:33 +0100 Subject: [PATCH] [FIX] account: make Journal Item company read-only PR #16826 (rev fa3ff5b41a179706bf99e81c9698f2600a98ece2) added the `company_id` field in the Journal Entry form. Unfortunately that field was not marked read-only, so creating a move would write to this field, triggering a useless and possibly very long recomputation of many related fields based on the company of the account. It must be read-only, its value solely driven by the value of the account_id field. --- 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 47ae40d49b3..f5b9cabe927 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -444,7 +444,7 @@ class AccountMoveLine(models.Model): tax_line_id = fields.Many2one('account.tax', string='Originator tax', ondelete='restrict') analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic tags') - company_id = fields.Many2one('res.company', related='account_id.company_id', string='Company', store=True) + company_id = fields.Many2one('res.company', related='account_id.company_id', string='Company', store=True, readonly=True) counterpart = fields.Char("Counterpart", compute='_get_counterpart', help="Compute the counter part accounts of this journal item for this journal entry. This can be needed in reports.") # TODO: put the invoice link and partner_id on the account_move