Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
78 Weergaven

How Can I Setup One to One a relationship Between Two Models in odoo enterprise 

And How Can I Setup Unique Constraint on a field in odoo enterprise 

Avatar
Annuleer
Beste antwoord

Since you say "setup" and "configuration" - you can't do this in Odoo Studio - or with an Odoo Online Standard plan.

And in general: ORM of Odoo does not have a One2one relationship field type. What you usually would do is to create a Many2one on one model and a One2many relationship on the other model. Then, on that other model, you'd create a computed Many2one relationship back to the first model (<- this is the part you wouldn't be able to do in Studio).

When you want to develop in Odoo, you will not get around reading https://www.odoo.com/documentation/19.0/developer/reference/backend/orm.html as a whole.

Constrains are described here as well: https://www.odoo.com/documentation/19.0/developer/reference/backend/orm.html#constraints-and-indexes

class AModel(models.Model):
    _name = 'a.model'
    _my_check = models.Constraint("CHECK (x > y)", "x > y is not true")
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
okt. 25
8
0
okt. 25
123
0
okt. 25
194
0
okt. 25
3
1
okt. 25
241