Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
82 Переглядів

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 

Аватар
Відмінити
Найкраща відповідь

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")
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
жовт. 25
8
0
жовт. 25
123
0
жовт. 25
194
0
жовт. 25
3
1
жовт. 25
242