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 | etc.
I was looking at the example of the OpenERP tutorial:
And I'm trying to replicate it with my own fields:
'meeting_id': fields.many2one('event.meeting', 'Meeting', ondelete='cascade'),
But I'm getting this error:
However, the event I want to get in that field has 4 as its ID, so, what is happening? (the rows in the table event_meeting have a column named event_id, which is a many2one field pointing to the id of the table event_event).
Just make your related fields as like below.
'meeting_id': fields.many2one('event.meeting', 'Meeting' ),
'event_id': fields.related('meeting_id', 'event_id', type='many2one', relation='event.event', string='Event', readonly=True, store=True),
If you want to make realted fields for M2O then you have to give the relation of the last field, here 'event_id' is the last field so, you have to give the relation is 'event.event'.
I hope it will resolve your issue.
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
|Asked: 12/1/14, 11:42 AM|
|Seen: 3006 times|
|Last updated: 3/16/15, 8:10 AM|