[IMP] calendar fix
bzr revid: tfr@openerp.com-20110309105959-zblg3a87gt9vu25w
This commit is contained in:
parent
5eb533a415
commit
3e7c4ec599
|
@ -60,6 +60,7 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
|
||||||
if exrule:
|
if exrule:
|
||||||
rset1.exrule(rrule.rrulestr(str(exrule), dtstart=startdate))
|
rset1.exrule(rrule.rrulestr(str(exrule), dtstart=startdate))
|
||||||
|
|
||||||
|
|
||||||
return list(rset1._iter())
|
return list(rset1._iter())
|
||||||
|
|
||||||
def base_calendar_id2real_id(base_calendar_id=None, with_date=False):
|
def base_calendar_id2real_id(base_calendar_id=None, with_date=False):
|
||||||
|
@ -373,7 +374,8 @@ property or property parameter."),
|
||||||
multi='event_end_date'),
|
multi='event_end_date'),
|
||||||
'ref': fields.reference('Event Ref', selection=_links_get, size=128),
|
'ref': fields.reference('Event Ref', selection=_links_get, size=128),
|
||||||
'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
|
'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'state': 'needs-action',
|
'state': 'needs-action',
|
||||||
'role': 'req-participant',
|
'role': 'req-participant',
|
||||||
|
@ -411,7 +413,7 @@ property or property parameter."),
|
||||||
cal = vobject.iCalendar()
|
cal = vobject.iCalendar()
|
||||||
event = cal.add('vevent')
|
event = cal.add('vevent')
|
||||||
if not event_obj.date_deadline or not event_obj.date:
|
if not event_obj.date_deadline or not event_obj.date:
|
||||||
raise osv.except_osv(_('Warning !'),_("Couldn't Invite because date is not specified!"))
|
raise osv.except_osv(_('Warning !'),_("Couldn't Invite because date is not specified!"))
|
||||||
event.add('created').value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'))
|
event.add('created').value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
event.add('dtstart').value = ics_datetime(event_obj.date)
|
event.add('dtstart').value = ics_datetime(event_obj.date)
|
||||||
event.add('dtend').value = ics_datetime(event_obj.date_deadline)
|
event.add('dtend').value = ics_datetime(event_obj.date_deadline)
|
||||||
|
@ -456,7 +458,7 @@ property or property parameter."),
|
||||||
trigger.value = delta
|
trigger.value = delta
|
||||||
# Compute other details
|
# Compute other details
|
||||||
valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP'
|
valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP'
|
||||||
|
|
||||||
for attendee in event_obj.attendee_ids:
|
for attendee in event_obj.attendee_ids:
|
||||||
attendee_add = event.add('attendee')
|
attendee_add = event.add('attendee')
|
||||||
attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
|
attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
|
||||||
|
@ -674,7 +676,7 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||||
new_res_alarm = alarm_ids[0]
|
new_res_alarm = alarm_ids[0]
|
||||||
cr.execute('UPDATE %s ' % model_obj._table + \
|
cr.execute('UPDATE %s ' % model_obj._table + \
|
||||||
' SET base_calendar_alarm_id=%s, alarm_id=%s ' \
|
' SET base_calendar_alarm_id=%s, alarm_id=%s ' \
|
||||||
' WHERE id=%s',
|
' WHERE id=%s',
|
||||||
(cal_alarm.id, new_res_alarm, data.id))
|
(cal_alarm.id, new_res_alarm, data.id))
|
||||||
|
|
||||||
self.do_alarm_unlink(cr, uid, [data.id], model)
|
self.do_alarm_unlink(cr, uid, [data.id], model)
|
||||||
|
@ -914,22 +916,6 @@ class calendar_event(osv.osv):
|
||||||
def _tz_get(self, cr, uid, context=None):
|
def _tz_get(self, cr, uid, context=None):
|
||||||
return [(x.lower(), x) for x in pytz.all_timezones]
|
return [(x.lower(), x) for x in pytz.all_timezones]
|
||||||
|
|
||||||
def onchange_allday(self, cr, uid, ids, allday, context=None):
|
|
||||||
"""Sets duration as 24 Hours if event is selected for all day
|
|
||||||
@param self: The object pointer
|
|
||||||
@param cr: the current row, from the database cursor,
|
|
||||||
@param uid: the current user’s ID for security checks,
|
|
||||||
@param ids: List of calendar event’s IDs.
|
|
||||||
@param allday: Value of allday boolean
|
|
||||||
@param context: A standard dictionary for contextual values
|
|
||||||
"""
|
|
||||||
if not allday or not ids:
|
|
||||||
return {}
|
|
||||||
value = {
|
|
||||||
'duration': 24
|
|
||||||
}
|
|
||||||
return {'value': value}
|
|
||||||
|
|
||||||
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None):
|
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None):
|
||||||
"""Returns duration and/or end date based on values passed
|
"""Returns duration and/or end date based on values passed
|
||||||
@param self: The object pointer
|
@param self: The object pointer
|
||||||
|
@ -954,6 +940,12 @@ class calendar_event(osv.osv):
|
||||||
if allday: # For all day event
|
if allday: # For all day event
|
||||||
value = {'duration': 24}
|
value = {'duration': 24}
|
||||||
duration = 24.0
|
duration = 24.0
|
||||||
|
if start_date:
|
||||||
|
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
||||||
|
start_date = datetime.strftime(datetime(start.year, start.month, start.day, 0,0,0), "%Y-%m-%d %H:%M:%S")
|
||||||
|
value['date'] = start_date
|
||||||
|
print start_date
|
||||||
|
|
||||||
|
|
||||||
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
||||||
if end_date and not duration:
|
if end_date and not duration:
|
||||||
|
@ -966,7 +958,7 @@ class calendar_event(osv.osv):
|
||||||
value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
|
value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
elif end_date and duration and not allday:
|
elif end_date and duration and not allday:
|
||||||
# we have both, keep them synchronized:
|
# we have both, keep them synchronized:
|
||||||
# set duration based on end_date (arbitrary decision: this avoid
|
# set duration based on end_date (arbitrary decision: this avoid
|
||||||
# getting dates like 06:31:48 instead of 06:32:00)
|
# getting dates like 06:31:48 instead of 06:32:00)
|
||||||
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
||||||
diff = end - start
|
diff = end - start
|
||||||
|
@ -1130,7 +1122,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
|
FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
|
||||||
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
|
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
|
||||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||||
('yearly', 'Yearly'),],
|
('yearly', 'Yearly'),],
|
||||||
'Recurrency', states={'done': [('readonly', True)]},
|
'Recurrency', states={'done': [('readonly', True)]},
|
||||||
help="Let the event automatically repeat at that interval"),
|
help="Let the event automatically repeat at that interval"),
|
||||||
'alarm_id': fields.many2one('res.alarm', 'Alarm', states={'done': [('readonly', True)]},
|
'alarm_id': fields.many2one('res.alarm', 'Alarm', states={'done': [('readonly', True)]},
|
||||||
|
@ -1148,7 +1140,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
('weekly', 'Weeks'),
|
('weekly', 'Weeks'),
|
||||||
('monthly', 'Months'),
|
('monthly', 'Months'),
|
||||||
('yearly', 'Years'), ], 'Frequency'),
|
('yearly', 'Years'), ], 'Frequency'),
|
||||||
|
|
||||||
'end_type' : fields.selection([('forever', 'Forever'), ('count', 'Fix amout of times'), ('end_date','End date')], 'Way to end reccurency'),
|
'end_type' : fields.selection([('forever', 'Forever'), ('count', 'Fix amout of times'), ('end_date','End date')], 'Way to end reccurency'),
|
||||||
'interval': fields.integer('Repeat every', help="Repeat every (Days/Week/Month/Year)"),
|
'interval': fields.integer('Repeat every', help="Repeat every (Days/Week/Month/Year)"),
|
||||||
'count': fields.integer('Repeat', help="Repeat x times"),
|
'count': fields.integer('Repeat', help="Repeat x times"),
|
||||||
|
@ -1159,7 +1151,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
'fr': fields.boolean('Fri'),
|
'fr': fields.boolean('Fri'),
|
||||||
'sa': fields.boolean('Sat'),
|
'sa': fields.boolean('Sat'),
|
||||||
'su': fields.boolean('Sun'),
|
'su': fields.boolean('Sun'),
|
||||||
'select1': fields.selection([('date', 'Date of month'),
|
'select1': fields.selection([('date', 'Date of month'),
|
||||||
('day', 'Day of month')], 'Option'),
|
('day', 'Day of month')], 'Option'),
|
||||||
'day': fields.integer('Date of month'),
|
'day': fields.integer('Date of month'),
|
||||||
'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \
|
'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \
|
||||||
|
@ -1176,8 +1168,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
'allday': fields.boolean('All Day', states={'done': [('readonly', True)]}),
|
'allday': fields.boolean('All Day', states={'done': [('readonly', True)]}),
|
||||||
'active': fields.boolean('Active', help="If the active field is set to \
|
'active': fields.boolean('Active', help="If the active field is set to \
|
||||||
true, it will allow you to hide the event alarm information without removing it."),
|
true, it will allow you to hide the event alarm information without removing it."),
|
||||||
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
|
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
|
||||||
'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."),
|
'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."),
|
||||||
}
|
}
|
||||||
def default_organizer(self, cr, uid, context=None):
|
def default_organizer(self, cr, uid, context=None):
|
||||||
user_pool = self.pool.get('res.users')
|
user_pool = self.pool.get('res.users')
|
||||||
|
@ -1204,12 +1196,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
def onchange_edit_all(self, cr, uid, ids, rrule_type,edit_all, context=None):
|
def onchange_edit_all(self, cr, uid, ids, rrule_type,edit_all, context=None):
|
||||||
if not context:
|
if not context:
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
value = {}
|
value = {}
|
||||||
if edit_all and rrule_type:
|
if edit_all and rrule_type:
|
||||||
for id in ids:
|
for id in ids:
|
||||||
base_calendar_id2real_id(id)
|
base_calendar_id2real_id(id)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):
|
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):
|
||||||
"""
|
"""
|
||||||
|
@ -1237,7 +1229,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100):
|
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100, context=None):
|
||||||
"""Gives virtual event ids for recurring events based on value of Recurrence Rule
|
"""Gives virtual event ids for recurring events based on value of Recurrence Rule
|
||||||
This method gives ids of dates that comes between start date and end date of calendar views
|
This method gives ids of dates that comes between start date and end date of calendar views
|
||||||
@param self: The object pointer
|
@param self: The object pointer
|
||||||
|
@ -1247,15 +1239,16 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
@param base_until_date: Get End Date
|
@param base_until_date: Get End Date
|
||||||
@param limit: The Number of Results to Return """
|
@param limit: The Number of Results to Return """
|
||||||
|
|
||||||
if not limit:
|
|
||||||
limit = 100
|
virtual_id = context and context.get('virtual_id', False) or False
|
||||||
|
|
||||||
if isinstance(select, (str, int, long)):
|
if isinstance(select, (str, int, long)):
|
||||||
ids = [select]
|
ids = [select]
|
||||||
else:
|
else:
|
||||||
ids = select
|
ids = select
|
||||||
result = []
|
result = []
|
||||||
recur_dict = []
|
recur_dict = []
|
||||||
if ids and (base_start_date or base_until_date):
|
if ids and virtual_id:
|
||||||
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, m.duration, \
|
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, m.duration, \
|
||||||
m.exdate, m.exrule, m.recurrent_id, m.recurrent_uid from " + self._table + \
|
m.exdate, m.exrule, m.recurrent_id, m.recurrent_uid from " + self._table + \
|
||||||
" m where m.id = ANY(%s)", (ids,) )
|
" m where m.id = ANY(%s)", (ids,) )
|
||||||
|
@ -1264,6 +1257,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
for data in cr.dictfetchall():
|
for data in cr.dictfetchall():
|
||||||
start_date = base_start_date and datetime.strptime(base_start_date[:10]+ ' 00:00:00' , "%Y-%m-%d %H:%M:%S") or False
|
start_date = base_start_date and datetime.strptime(base_start_date[:10]+ ' 00:00:00' , "%Y-%m-%d %H:%M:%S") or False
|
||||||
until_date = base_until_date and datetime.strptime(base_until_date[:10]+ ' 23:59:59', "%Y-%m-%d %H:%M:%S") or False
|
until_date = base_until_date and datetime.strptime(base_until_date[:10]+ ' 23:59:59', "%Y-%m-%d %H:%M:%S") or False
|
||||||
|
print count
|
||||||
if count > limit:
|
if count > limit:
|
||||||
break
|
break
|
||||||
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
||||||
|
@ -1274,7 +1268,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
continue
|
continue
|
||||||
if until_date and (event_date > until_date):
|
if until_date and (event_date > until_date):
|
||||||
continue
|
continue
|
||||||
idval = real_id2base_calendar_id(data['id'], data['date'])
|
idval = data['id']
|
||||||
if not data['recurrent_id']:
|
if not data['recurrent_id']:
|
||||||
result.append(idval)
|
result.append(idval)
|
||||||
count += 1
|
count += 1
|
||||||
|
@ -1317,7 +1311,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
continue
|
continue
|
||||||
idval = real_id2base_calendar_id(data['id'], r_date.strftime("%Y-%m-%d %H:%M:%S"))
|
idval = real_id2base_calendar_id(data['id'], r_date.strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
result.append(idval)
|
result.append(idval)
|
||||||
|
print "count", count
|
||||||
count += 1
|
count += 1
|
||||||
|
if count > limit:
|
||||||
|
break
|
||||||
|
|
||||||
|
print "result", result
|
||||||
if result:
|
if result:
|
||||||
ids = list(set(result)-set(recur_dict))
|
ids = list(set(result)-set(recur_dict))
|
||||||
if isinstance(select, (str, int, long)):
|
if isinstance(select, (str, int, long)):
|
||||||
|
@ -1342,7 +1341,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
freq=datas.get('rrule_type')
|
freq=datas.get('rrule_type')
|
||||||
if freq == 'none':
|
if freq == 'none':
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
|
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
|
||||||
|
|
||||||
if freq == 'weekly':
|
if freq == 'weekly':
|
||||||
|
@ -1358,7 +1357,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
elif datas.get('select1')=='date':
|
elif datas.get('select1')=='date':
|
||||||
monthstring = ';BYMONTHDAY=' + str(datas.get('day'))
|
monthstring = ';BYMONTHDAY=' + str(datas.get('day'))
|
||||||
|
|
||||||
|
|
||||||
if datas.get('end_date'):
|
if datas.get('end_date'):
|
||||||
datas['end_date'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + 'T235959Z'
|
datas['end_date'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + 'T235959Z'
|
||||||
enddate = (datas.get('count') and (';COUNT=' + str(datas.get('count'))) or '') +\
|
enddate = (datas.get('count') and (';COUNT=' + str(datas.get('count'))) or '') +\
|
||||||
|
@ -1371,17 +1370,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
|
|
||||||
def search(self, cr, uid, args, offset=0, limit=100, order=None,
|
def search(self, cr, uid, args, offset=0, limit=100, order=None,
|
||||||
context=None, count=False):
|
context=None, count=False):
|
||||||
"""
|
|
||||||
Overrides orm search method.
|
|
||||||
@param cr: the current row, from the database cursor,
|
|
||||||
@param user: the current user’s ID for security checks,
|
|
||||||
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
|
||||||
@param offset: The Number of Results to Pass
|
|
||||||
@param limit: The Number of Results to Return
|
|
||||||
@param context: A standard dictionary for contextual values
|
|
||||||
@param count: If its True the method returns number of records instead of ids
|
|
||||||
@return: List of id
|
|
||||||
"""
|
|
||||||
args_without_date = []
|
args_without_date = []
|
||||||
start_date = False
|
start_date = False
|
||||||
until_date = False
|
until_date = False
|
||||||
|
@ -1400,10 +1389,11 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
until_date = arg[2]
|
until_date = arg[2]
|
||||||
res = super(calendar_event, self).search(cr, uid, args_without_date, \
|
res = super(calendar_event, self).search(cr, uid, args_without_date, \
|
||||||
offset, limit, order, context, count)
|
offset, limit, order, context, count)
|
||||||
|
print "result normaux", res
|
||||||
res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
|
res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit, context=context)
|
||||||
|
print "result de merde", res
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
def get_edit_all(self, cr, uid, id, vals=None):
|
def get_edit_all(self, cr, uid, id, vals=None):
|
||||||
"""
|
"""
|
||||||
|
@ -1414,10 +1404,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
if(vals and 'edit_all' in vals): #we jsut check edit_all
|
if(vals and 'edit_all' in vals): #we jsut check edit_all
|
||||||
return vals['edit_all']
|
return vals['edit_all']
|
||||||
else: #it's a recurrent event and edit_all is already check
|
else: #it's a recurrent event and edit_all is already check
|
||||||
return meeting['recurrency'] and meeting['edit_all']
|
return meeting['recurrency'] and meeting['edit_all']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||||
"""
|
"""
|
||||||
|
@ -1440,12 +1430,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
res = False
|
res = False
|
||||||
for event_id in select:
|
for event_id in select:
|
||||||
real_event_id = base_calendar_id2real_id(event_id)
|
real_event_id = base_calendar_id2real_id(event_id)
|
||||||
|
|
||||||
|
|
||||||
if(self.get_edit_all(cr, uid, event_id, vals=vals)):
|
if(self.get_edit_all(cr, uid, event_id, vals=vals)):
|
||||||
event_id = real_event_id
|
event_id = real_event_id
|
||||||
|
|
||||||
|
|
||||||
if len(str(event_id).split('-')) > 1:
|
if len(str(event_id).split('-')) > 1:
|
||||||
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
||||||
'rrule', 'duration', 'exdate'])
|
'rrule', 'duration', 'exdate'])
|
||||||
|
@ -1459,15 +1449,15 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
'edit_all': False,
|
'edit_all': False,
|
||||||
'recurrency' : False,
|
'recurrency' : False,
|
||||||
})
|
})
|
||||||
|
|
||||||
new_id = self.copy(cr, uid, real_event_id, default=data, context=context)
|
new_id = self.copy(cr, uid, real_event_id, default=data, context=context)
|
||||||
|
|
||||||
date_new = event_id.split('-')[1]
|
date_new = event_id.split('-')[1]
|
||||||
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
||||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||||
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
||||||
res = self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
res = self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
||||||
|
|
||||||
context.update({'active_id': new_id, 'active_ids': [new_id]})
|
context.update({'active_id': new_id, 'active_ids': [new_id]})
|
||||||
continue
|
continue
|
||||||
if not real_event_id in new_ids:
|
if not real_event_id in new_ids:
|
||||||
|
@ -1590,10 +1580,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
res = False
|
res = False
|
||||||
for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context):
|
for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context):
|
||||||
event_id = event_datas['id']
|
event_id = event_datas['id']
|
||||||
|
|
||||||
if self.get_edit_all(cr, uid, event_id, vals=None):
|
if self.get_edit_all(cr, uid, event_id, vals=None):
|
||||||
event_id = base_calendar_id2real_id(event_id)
|
event_id = base_calendar_id2real_id(event_id)
|
||||||
|
|
||||||
if isinstance(event_id, (int, long)):
|
if isinstance(event_id, (int, long)):
|
||||||
res = super(calendar_event, self).unlink(cr, uid, event_id, context=context)
|
res = super(calendar_event, self).unlink(cr, uid, event_id, context=context)
|
||||||
self.pool.get('res.alarm').do_alarm_unlink(cr, uid, [event_id], self._name)
|
self.pool.get('res.alarm').do_alarm_unlink(cr, uid, [event_id], self._name)
|
||||||
|
@ -1626,6 +1616,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
|
virtual_id = context.get('virtual_id', False)
|
||||||
|
|
||||||
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
|
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
|
||||||
vals['vtimezone'] = vals['vtimezone'][40:]
|
vals['vtimezone'] = vals['vtimezone'][40:]
|
||||||
|
|
||||||
|
@ -1640,6 +1632,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
||||||
res = super(calendar_event, self).create(cr, uid, vals, context)
|
res = super(calendar_event, self).create(cr, uid, vals, context)
|
||||||
alarm_obj = self.pool.get('res.alarm')
|
alarm_obj = self.pool.get('res.alarm')
|
||||||
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date', context=context)
|
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date', context=context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if vals.get('rrule_type') != 'none' and virtual_id:
|
||||||
|
res = real_id2base_calendar_id(res, vals.get('date', False))
|
||||||
|
print "id", res
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def do_tentative(self, cr, uid, ids, context=None, *args):
|
def do_tentative(self, cr, uid, ids, context=None, *args):
|
||||||
|
@ -1711,7 +1709,7 @@ class calendar_todo(osv.osv):
|
||||||
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
||||||
@param context: A standard dictionary for contextual values
|
@param context: A standard dictionary for contextual values
|
||||||
"""
|
"""
|
||||||
|
|
||||||
assert name == 'date'
|
assert name == 'date'
|
||||||
return self.write(cr, uid, id, { 'date_start': value }, context=context)
|
return self.write(cr, uid, id, { 'date_start': value }, context=context)
|
||||||
|
|
||||||
|
@ -1743,9 +1741,9 @@ class ir_attachment(osv.osv):
|
||||||
for arg in args:
|
for arg in args:
|
||||||
args1.append(map(lambda x:str(x).split('-')[0], arg))
|
args1.append(map(lambda x:str(x).split('-')[0], arg))
|
||||||
return super(ir_attachment, self).search_count(cr, user, args1, context)
|
return super(ir_attachment, self).search_count(cr, user, args1, context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
if context:
|
if context:
|
||||||
id = context.get('default_res_id', False)
|
id = context.get('default_res_id', False)
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<field name="res_model">crm.meeting</field>
|
<field name="res_model">crm.meeting</field>
|
||||||
<field name="view_mode">calendar,tree,form,gantt</field>
|
<field name="view_mode">calendar,tree,form,gantt</field>
|
||||||
<field name="view_id" ref="crm_case_calendar_view_meet"/>
|
<field name="view_id" ref="crm_case_calendar_view_meet"/>
|
||||||
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
|
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id, 'virtual_id' : True}</field>
|
||||||
<field name="search_view_id" ref="view_crm_case_meetings_filter"/>
|
<field name="search_view_id" ref="view_crm_case_meetings_filter"/>
|
||||||
<field name="help">The meeting calendar is shared between the sales teams and fully integrated with other applications such as the employee holidays or the business opportunities. You can also synchronize meetings with your mobile phone using the caldav interface.
|
<field name="help">The meeting calendar is shared between the sales teams and fully integrated with other applications such as the employee holidays or the business opportunities. You can also synchronize meetings with your mobile phone using the caldav interface.
|
||||||
</field>
|
</field>
|
||||||
|
|
Loading…
Reference in New Issue