Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată

Hi,

I try to define a relation between an abstract and "normal" model running Odoo15.

class A(models.AbstractModel):
_name = 'a'
part_ids = fields.One2many('part', a_id)

class Part(models.Model):
_name = 'part'
a_id = fields.Many2one('a')

class B(models.Model):
_name = 'b'
_inherit = 'a'
y = fields...

class C(models.Model):
_name = 'c'
_inherit = 'a'
x = fields...


A should be a generalization for B and C which both can have associated parts.
But whenever I try to add a new Part object to a B or C instance, I'll get the message 'a' object has no attribute 'id'. Somehow this seems logical as A is abstract. Well. What is the correct approach defining such a relation?

Thanks in advance,

Wolfgang

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
dec. 19
4347
4
feb. 25
2590
1
aug. 24
2178
2
nov. 24
3315
3
oct. 23
14846