hey please anybody help me i have problem in my program tell about how to create many 2one fields
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
2
Replies
3339
Views
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),
}
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