Odoo Help


how to create many2one fields in openerp7

on 12/25/13, 3:38 PM 1,109 views

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

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'),

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


Ray Carnes

--Ray Carnes--
| 9 7 9
Atlanta, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0.

Completed Odoo Functional and Technical Training.

Major Skills:

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 12/25/13, 6:51 PM
    'Field relation id',
    [, Optional parameters])



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),


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.


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)


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