This question has been flagged
2 Replies
4313 Views

Hello Guys

I am always confuse when we use "one2many" and "many2one"  relationship in table of  Openerp 7

Thanks

Avatar
Discard
Best Answer

HI,

Refer the following link,it may help you:
https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/field_type/#relational-types

Avatar
Discard
Best Answer

take a scenario- suppose one author writes n books we can mark that field as one2many relation and in one2many line we can add only the data. MANY2one take an example of student.one student relates to one division then we use many2one relation like -student_name:fields.may2one('student.ifo','Student Name') in many2one relation we can create and edit option available also we can select the data .

Try this  code--

 

'library_line_id':fields.one2many('library.form.line','library_id','Books',required=True,readonly=True,select=True,states={'draft':[('readonly', False)]}) 'library_id':fields.many2one('library.form','Library Form line'

Avatar
Discard