Odoo Help

0

how to create many2one fields in openerp7

By
Arunagiri
on 12/25/13, 3:38 PM 1,289 views

hey please anybody help me i have problem in my program tell about how to create many 2one fields

0
Ray Carnes
On 12/25/13, 6:51 PM
fields.one2many(
    'other.object.name',
    'Field relation id',
    'Fieldname' 
    [, Optional parameters])

https://doc.openerp.com/trunk/server/03_module_dev_02/

Example:

class travel_hostel(osv.osv):
   _name = 'travel.hostel'
   _inherit = 'res.partner'

   _columns = {
   'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'),
   'quality': fields.char('Quality', size=16),
   }

https://doc.openerp.com/trunk/server/03_module_dev_05/

0
Abhishek H Menon
On 12/26/13, 5:23 AM
from osv import fields, osv
class sample(osv.osv)
              _name = 'sample.sample'
              _columns = {
                      'm2ofield1': fields.many2one('relation1','M2O'),
                       }
sample()

Here m2ofield1 is the many2one field. relation1 is the table which you are tending to relate the table sample.sample with. Here the point should be noted is the table relation1 should exists before sample.sample otherwise error will occur

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 12/25/13, 3:38 PM
Seen: 1289 times
Last updated: 3/16/15, 8:10 AM