Hi All,
I'm using Odoo 10, and I'm customizing the calendar. I'd like to override the method read of 'calendar.event'
The original method is:
def read(self, fields=None, load='_classic_read'):
fields2 = fields and fields[:] or None
EXTRAFIELDS = ('privacy', 'user_id', 'duration', 'allday', 'start', 'start_date', 'start_datetime', 'rrule')
for f in EXTRAFIELDS:
if fields and (f not in fields):
fields2.append(f)
select = map(lambda x: (x, calendar_id2real_id(x)), self.ids)
real_events = self.browse([real_id for calendar_id, real_id in select])
real_data = super(Meeting, real_events).read(fields=fields2, load=load)
real_data = dict((d['id'], d) for d in real_data)
.....
and my customized class and method:
class MyMeeting(models.Model):
_inherit = 'calendar.event'
def read(self, fields=None, load='_classic_read'):
fields2 = fields and fields[:] or None
EXTRAFIELDS = (
'privacy', 'user_id', 'duration', 'allday', 'start', 'start_date',
'start_datetime', 'rrule')
for f in EXTRAFIELDS:
if fields and (f not in fields):
fields2.append(f)
select = map(lambda x: (x, calendar_id2real_id(x)), self.ids)
real_events = self.browse([real_id for calendar_id, real_id in select])
real_data = super(Meeting, real_events).read(fields=fields2, load=load)
real_data = dict((d['id'], d) for d in real_data)
.....
I want the new function 'read' in MyMeeting will be executed, not related to the 'read' in original class 'Meeting'.
But, in my new MyMeeting class, it does not understand the class 'Meeting'. And I don't want to change anything in the original class
real_data = super(Meeting, real_events).read(fields=fields2, load=load)
How can I resolve this?
Thank you.