Anyone can tell what are difference between one2many, many2one and many2many in odoo . what are the usage of three of those?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
Many2one : Store a relation against a co-model:
arel_id = fields.Many2one('res.users')
arel_id = fields.Many2one(comodel_name='res.users')
an_other_rel_id = fields.Many2one(comodel_name='res.partner', delegate=True)
Specific options:
comodel_name: name of the opposite model
delegate: set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)
One2many : Store a relation against many rows of co-model:
arel_ids = fields.One2many('res.users', 'rel_id')
arel_ids = fields.One2many(comodel_name='res.users', inverse_name='rel_id')
Specific options:
comodel_name: name of the opposite model
inverse_name: relational column of the opposite model
Many2many : Store a relation against many2many rows of co-model:
arel_ids = fields.Many2many('res.users')
arel_ids = fields.Many2many(comodel_name='res.users', relation='table_name', column1='col_name', column2='other_col_name')
Specific options:
comodel_name: name of the opposite model
relation: relational table name
columns1: relational table left column name
columns2: relational table right column name
hello you can refer this below website
http://serpentcs.com/serpentcs-relational-fields-in-openerp-270
https://www.odoo.com/documentation/10.0/reference/orm.html#relational-fields
Hi,
You can see the difference in this page: https://www.odoo.com/documentation/10.0/howtos/backend.html#relations-between-models
It is very similar to the relationships of the databases. For example, when we transform the entity-relationship diagram to tables.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden