Hi,
I'm trying to override a method in the class calendar_event, I see in here that is needed to re-define columns/fields but my function don have any field defined in the columns...
So what I've tried was this :
class calendar_event(osv.osv):
_name = 'calendar.event'
_inherit = "calendar.event"
def create_attendees(self, cr, uid, ids, context):
att_obj = self.pool.get('calendar.attendee')
print 'JUST Print something to see if it uses this function '
user_obj = self.pool.get('res.users')
current_user = user_obj.browse(cr, uid, uid, context=context)
for event in self.browse(cr, uid, ids, context):
attendees = {}
for att in event.attendee_ids:
attendees[att.partner_id.id] = True
new_attendees = []
mail_to = ""
for partner in event.partner_ids:
if partner.id in attendees:
continue
att_id = self.pool.get('calendar.attendee').create(cr, uid, {
'partner_id': partner.id,
'user_id': partner.user_ids and partner.user_ids[0].id or False,
'ref': self._name+','+str(event.id),
'email': partner.email
}, context=context)
if partner.email:
mail_to = mail_to + " " + partner.email
self.write(cr, uid, [event.id], {
'attendee_ids': [(4, att_id)]
}, context=context)
new_attendees.append(att_id)
if mail_to and current_user.email:
att_obj._send_mail(cr, uid, new_attendees, mail_to,
email_from = current_user.email, context=context)
return True
calendar_event()
How can I do this?