I was looking at the example of the OpenERP tutorial:
'country_id': fields.related(
'state_id',
'country_id',
type="many2one",
relation="res.country",
string="Country",
store=False)
And I'm trying to replicate it with my own fields:
'meeting_id': fields.many2one('event.meeting', 'Meeting', ondelete='cascade'),
'event_id': fields.related(
'meeting_id',
'event_id',
type='many2one',
relation='event.meeting',
string='Event'),
But I'm getting this error:
KeyError: 4
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).
meeting_id need to be another field in the same model as event_id is defined. event_id need to be a field in the model that is represented by meeting_id. 'event.meeting' need to be the model that event_id (the field in the meeting_id) represents.