Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

One2many relationship in _inherit mode

Subscriure's

Get notified when there's activity on this post

This question has been flagged
inheritanceone2manyv14
3230 Vistes
Avatar
Samir SELLAMI

Hi All, let me explain my scenario: 

I am developing new custom module where I have two child models "B" and "C" _inherit from parent model "A". The main model "A" has a One2many relationship with another model "D". Odoo 14 raise an error [*] when interacting with "field_ids" added to the views of "B" or "C". However, the error does not occur when declaring the One2many relationship field between, for example, the child model "B" and the model "D" ! but this does not make sense to me as I understood inheritance, because in this case the model "D" must have multiple Many2one fields ("B_id" and "C_id") referring to child models "B" and "C" respectively instead of a single Many2one field "A_id" referring to the main model "A". 

Why is the One2many relationship not supported in the _inherit mode in Odoo14?

-----------------------------

* File "C:\Odoo14\odoo\odoo\models.py", line 5168, in _update_cache raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name)) Exception 

If i understood the error, Odoo excepted to find the fields of the child model in the main model ?!

0
Avatar
Descartar
Ibrahim Boudmir

Hi,
if i understood well your issue, When you add the O2M field in a view declared in module where B (or C ) exists, Odoo raises an error ?

If yes, did you add the dependancy between modules where O2M is declared and B ( or C ) is defined ? == Module where B is defined must depend on module where O2M is declared.

Samir SELLAMI
Autor

Hi Ibrahim,

All the models A, B, C and D are part of the same module !

Ibrahim Boudmir

if they are in the sale module, then why you inherit multiple times a model that's already defined ? you can work directly with A..
Example:
In the same module, file 1, I define model A
in file 2, if I need to work with A, I shouldn't redefine a new model B with _inherit from A ( what you're doing right now )
you can go back to file 1, model A and add the fields you want..

hope it's clear.

Samir SELLAMI
Autor

Dear Ibrahim, the models in the above scenario are part of completely a new custom module I am currently developing and are not part of existing Odoo modules. Thank you.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
js_class for one2many DialogForm views (odoo 14.0)
inheritance one2many formview v14 Javascript
Avatar
Avatar
1
de jul. 25
3653
add field inside inherited notebook odoo14
inheritance notebook v14
Avatar
Avatar
1
d’abr. 23
2531
Many2many default behavior
views one2many v14
Avatar
Avatar
1
de jul. 22
3165
Odoo 14: One2many should have autoincrement numbers Solved
one2many autoincrement v14
Avatar
Avatar
1
de des. 21
4528
Odoo 14: One2many field - problem with adding a page in notebook Solved
one2many notebook v14
Avatar
Avatar
1
de gen. 21
7912
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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