[FIX]: caldav: Fixed problem of alarms

bzr revid: rpa@openerp.co.in-20100127101532-7l3fay515bijf11i
This commit is contained in:
rpa (Open ERP) 2010-01-27 15:45:32 +05:30
parent fc2e98a003
commit 1011c0fffa
1 changed files with 9 additions and 3 deletions

View File

@ -252,6 +252,9 @@ are both optional, but if one occurs, so MUST the other"""),
model_obj = self.pool.get(model)
for data in model_obj.browse(cr, uid, ids):
basic_alarm = data.alarm_id
if not context.get('alarm_id'):
self.do_alarm_unlink(cr, uid, [data.id], model)
return True
self.do_alarm_unlink(cr, uid, [data.id], model)
if basic_alarm:
vals = {
@ -297,7 +300,7 @@ res_alarm()
class calendar_alarm(osv.osv):
_name = 'calendar.alarm'
_description = 'Event alarm information'
_inherits = {'res.alarm': "alarm_id"}
_inherit = 'res.alarm'
__attribute__ = {}
_columns = {
@ -616,6 +619,8 @@ rule or repeating pattern for anexception to a recurrence set"),
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
if not context:
context = {}
if isinstance(ids, (str, int, long)):
select = [ids]
else:
@ -626,9 +631,10 @@ rule or repeating pattern for anexception to a recurrence set"),
if not id in new_ids:
new_ids.append(id)
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if vals.has_key('alarm_id'):
if vals.has_key('alarm_id') or vals.has_key('caldav_alarm_id'):
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date')
context.update({'alarm_id': vals.get('alarm_id')})
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', context=context)
return res
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}):