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.
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
|Asked: 12/1/14, 11:42 AM|
|Seen: 2233 times|
|Last updated: 3/16/15, 8:10 AM|