Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged

I need to create a type of one2one between several models, does someone have a clue how to manage this? Here are the facts:

  • I have the default model crm.lead
  • Now i need to add more two models e.g.
    • crm.lead.foo and crm.lead.bar
    • Both new models are linked to the crm.lead object using a field lead_id as many2one
    • lead_id = fields.Many2one('crm.lead', string='Lead', ondelete='cascade')
  • Now in the crm.lead i need to add the relation by sth like a "one2one" that doesn't exist.
  • I think the best/better way is to add the relation with a Many2one field from the crm.lead to link it to the foo and bar (writing the value on create)
    • crm_lead_foo = fields.Many2one('crm.lead.foo')
  • Basically the link works and i can choose the foo/bar and edit it's fields
  • But the edit does only work when opening the foo/bar in a new form
  • I need to show the form of the crm.lead.foo form inline in the crm.lead form, is there any widget that can manage this?


Note:
I know, I would be able to add all needed fields as related fields into the crm.lead form to make them working inline. But I need to add several new models (not only 2) with many fields each. Additionally i will need to add the models based on the opportunity_id also in the sale.order and the project.project forms.... so i'm looking for a clean solution without adding much trash to my core models.


Thank you for your help and ideas!

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
sep. 18
4360
1
okt. 15
6073
3
maj 24
15015
0
dec. 21
3298
0
mar. 16
3086