We have 2 custom modules A and B:
Module A extends res.partner by a simple selection from a static list of predefined values:
class Partner(models.Model):
_inherit = "res.partner"
status = fields.Selection(STATUS, default="0")
Module B (depending on A by its manifest) extends account.move and relates to the status of a company via a Many2One:
class AccountMove(models.Model):
_inherit = "account.move"
partner_company_id = fields.Many2one("res.partner", compute="_compute_parent", store=True)
status = fields.Selection(related="partner_company_id.status", store=True)
After later changes to module A we want to upgrade it in Odoo via the 'Apps' menu, but we get an error message (the same we get when we try to upgrade module B with no changes at all).
File "/odoo17/odoo/fields.py", line 606, in setup_related
raise KeyError(
KeyError: 'Field status referenced in related field definition account.move.status does not exist.'
Can we fix this somehow? Or is this an Odoo bug, due to the Many2One->related combination that Odoo can not handle correctly on the upgrade / transition?