0

I'm building my own module to manage fairs and exhibitions. The booth model from my module should have a direct connection to the booth model from the odoo events module (event.booth)

Every booth from my module can only have exactly one booth from the odoo events module and vice versa. That's why I would need a fields.One2one relationship, dont I? Unfortunately, it seems like one2one relationships are no longer possible in odoo? Can anyone tell me how to implement this relationship in odoo15?

unnamed-dev
  • 165
  • 8
  • Should it be possible to link an existing odoo event booth to your booth records? OR should Odoo create an event booth to every one of your booths? Because then you should use the [delegation inheritance mechanism](https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/13_inheritance.html#model-inheritance). – CZoellner Jul 11 '22 at 12:36

1 Answers1

1

There are couuple of things to try

  1. Use only one model add your data to the existing model
  2. Use normal Many2one and One2many pair, and then constraint the Many to one field
    _sql_constraints = [
        ('booth_uniq', 'unique(booth_id)', 'Only one booth can be linked !'),
    ]
  1. Use Delegation inheritance, it does probably need constraint aswell
Paxmees
  • 1,540
  • 1
  • 15
  • 28