[FIX] account: make Journal Item company read-only

PR #16826 (rev fa3ff5b41a) 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.
This commit is contained in:
Olivier Dony
2018-03-19 17:43:33 +01:00
parent 3ceae65669
commit 284c5ba50d
+1 -1
View File
@@ -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