Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profit organisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

v17: Module upgrade fails due to Many2one-related field

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
many2oneupgraderelated_fieldsv17
1 Beantwoorden
468 Weergaven
Avatar
Peter Schiffmann

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?

0
Avatar
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord

Hi,



This issue occurs because of how Odoo handles module dependencies and related fields during upgrades. In your setup, Module A adds the status field to res.partner, while Module B creates a related field in account.move that depends on res.partner.status. When you upgrade Module A, Odoo temporarily reloads its model definitions, and since Module B’s related field still references a field that hasn’t been fully reloaded, it triggers a KeyError. This isn’t exactly a bug in your code but rather a limitation of Odoo’s registry initialization process when dealing with interdependent modules.


To fix it, the simplest method is to upgrade the modules in the correct order, upgrade Module A first, then Module B. If the Apps interface doesn’t work, this can be done using terminal commands with -u module_a followed by -u module_b.


If that doesn’t resolve it, you can temporarily disable the related field in Module B (by removing the related parameter), upgrade Module A, and then restore the related field after Module A has loaded successfully.


A more robust solution is to replace the related field with a computed field that depends on partner_company_id.status. This avoids hard registry dependencies during startup and ensures that upgrades run smoothly regardless of the module loading order.


Finally, make sure Module B’s manifest explicitly declares a dependency on Module A. In short, this issue is caused by Odoo’s dependency loading sequence, and the best long-term fix is to use a computed field or carefully manage module upgrade order.


Hope it helps

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
v17: how to add related field in this scenario?
related_fields v17
Avatar
Avatar
1
jan. 24
2969
When is the scheduled date for the production upgrade to Odoo 17.0 on odoo.sh? Opgelost
upgrade v17
Avatar
Avatar
1
jan. 24
2059
Write to Record in Related Field of Many2One Relationship
many2one related_fields
Avatar
0
mei 15
7237
Showing only name in Many2one field relation res.parter Opgelost
many2one res.partner v17
Avatar
Avatar
1
jul. 24
4061
Send a value from context one2many
many2one related_fields odoo15
Avatar
0
mei 24
1780
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now