Odoo Help

Welcome!

This community 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.

0

how to create many2one fields in openerp7

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

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

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

0

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

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/

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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