[IMP] fixes on crm meeting: recurring events, show as free/busy, pricate/confidential
bzr revid: fp@tinyerp.com-20111211201237-gdi2te310wh2pa5z
This commit is contained in:
parent
daff20faae
commit
7f861f6233
|
@ -1009,10 +1009,19 @@ class calendar_event(osv.osv):
|
|||
else:
|
||||
result[event] = ""
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _rrule_write(self, obj, cr, uid, ids, field_name, field_value, args, context=None):
|
||||
data = self._get_empty_rrule_data()
|
||||
if field_value:
|
||||
data['recurrency'] = True
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
rdate = rule_date or event.date
|
||||
update_data = self._parse_rrule(field_value, dict(data), rdate)
|
||||
data.update(update_data)
|
||||
super(calendar_event, obj).write(cr, uid, ids, data, context=context)
|
||||
return True
|
||||
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
|
@ -1023,7 +1032,7 @@ class calendar_event(osv.osv):
|
|||
'duration': fields.float('Duration', states={'done': [('readonly', True)]}),
|
||||
'description': fields.text('Description', states={'done': [('readonly', True)]}),
|
||||
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
|
||||
('confidential', 'Confidential')], 'Mark as', states={'done': [('readonly', True)]}),
|
||||
('confidential', 'Public for Employees')], 'Mark as', states={'done': [('readonly', True)]}),
|
||||
'location': fields.char('Location', size=264, help="Location of Event", states={'done': [('readonly', True)]}),
|
||||
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \
|
||||
'Show as', states={'done': [('readonly', True)]}),
|
||||
|
@ -1036,7 +1045,7 @@ defines the list of date/time exceptions for a recurring calendar component."),
|
|||
'exrule': fields.char('Exception Rule', size=352, help="Defines a \
|
||||
rule or repeating pattern of time to exclude from the recurring rule."),
|
||||
'rrule': fields.function(_get_rulestring, type='char', size=124, \
|
||||
store=True, string='Recurrent Rule'),
|
||||
fnct_inv=_rrule_write, store=True, string='Recurrent Rule'),
|
||||
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
|
||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||
('yearly', 'Yearly'),],
|
||||
|
@ -1079,7 +1088,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'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."),
|
||||
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
|
||||
'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."),
|
||||
}
|
||||
|
||||
def default_organizer(self, cr, uid, context=None):
|
||||
|
@ -1102,83 +1110,78 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'active': 1,
|
||||
'user_id': lambda self, cr, uid, ctx: uid,
|
||||
'organizer': default_organizer,
|
||||
'edit_all' : False,
|
||||
}
|
||||
|
||||
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100, context=None):
|
||||
def get_recurrent_ids(self, cr, uid, select, domain, limit=100, context=None):
|
||||
"""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
|
||||
@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 base_start_date: Get Start Date
|
||||
@param base_until_date: Get End Date
|
||||
@param limit: The Number of Results to Return """
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
virtual_id = context and context.get('virtual_id', False) or False
|
||||
|
||||
if isinstance(select, (str, int, long)):
|
||||
ids = [select]
|
||||
else:
|
||||
ids = select
|
||||
result = []
|
||||
if ids and virtual_id:
|
||||
for data in super(calendar_event, self).read(cr, uid, ids, context=context):
|
||||
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
|
||||
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
||||
for data in super(calendar_event, self).read(cr, uid, select, context=context):
|
||||
if not data['rrule']:
|
||||
result.append(data['id'])
|
||||
continue
|
||||
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
||||
# To check: If the start date is replace by event date .. the event date will be changed by that of calendar code
|
||||
|
||||
if not data['rrule']:
|
||||
if start_date and (event_date < start_date):
|
||||
continue
|
||||
if until_date and (event_date > until_date):
|
||||
continue
|
||||
idval = data['id']
|
||||
result.append(idval)
|
||||
else:
|
||||
start_date = event_date
|
||||
exdate = data['exdate'] and data['exdate'].split(',') or []
|
||||
rrule_str = data['rrule']
|
||||
new_rrule_str = []
|
||||
rrule_until_date = False
|
||||
is_until = False
|
||||
for rule in rrule_str.split(';'):
|
||||
name, value = rule.split('=')
|
||||
if name == "UNTIL":
|
||||
is_until = True
|
||||
value = parser.parse(value)
|
||||
rrule_until_date = parser.parse(value.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
if until_date and until_date >= rrule_until_date:
|
||||
until_date = rrule_until_date
|
||||
if until_date:
|
||||
value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
else:
|
||||
value = value.strftime("%Y%m%d%H%M%S")
|
||||
new_rule = '%s=%s' % (name, value)
|
||||
new_rrule_str.append(new_rule)
|
||||
if not is_until and until_date:
|
||||
value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
name = "UNTIL"
|
||||
new_rule = '%s=%s' % (name, value)
|
||||
new_rrule_str.append(new_rule)
|
||||
new_rrule_str = ';'.join(new_rrule_str)
|
||||
rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date, data['exrule'])
|
||||
|
||||
for r_date in rdates:
|
||||
if start_date and r_date < start_date:
|
||||
continue
|
||||
if until_date and r_date > until_date:
|
||||
continue
|
||||
idval = real_id2base_calendar_id(data['id'], r_date.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
result.append(idval)
|
||||
|
||||
if result:
|
||||
ids = list(set(result))
|
||||
if not data['rrule']:
|
||||
continue
|
||||
|
||||
exdate = data['exdate'] and data['exdate'].split(',') or []
|
||||
rrule_str = data['rrule']
|
||||
new_rrule_str = []
|
||||
rrule_until_date = False
|
||||
is_until = False
|
||||
for rule in rrule_str.split(';'):
|
||||
name, value = rule.split('=')
|
||||
if name == "UNTIL":
|
||||
is_until = True
|
||||
value = parser.parse(value)
|
||||
rrule_until_date = parser.parse(value.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
if until_date and until_date >= rrule_until_date:
|
||||
until_date = rrule_until_date
|
||||
if until_date:
|
||||
value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
else:
|
||||
value = value.strftime("%Y%m%d%H%M%S")
|
||||
new_rule = '%s=%s' % (name, value)
|
||||
new_rrule_str.append(new_rule)
|
||||
#if not is_until and until_date:
|
||||
# value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
# name = "UNTIL"
|
||||
# new_rule = '%s=%s' % (name, value)
|
||||
# new_rrule_str.append(new_rule)
|
||||
new_rrule_str = ';'.join(new_rrule_str)
|
||||
rdates = get_recurrent_dates(str(new_rrule_str), exdate, event_date, data['exrule'])
|
||||
for r_date in rdates:
|
||||
ok = True
|
||||
for arg in domain:
|
||||
if arg[0] in ('date', 'date_deadline'):
|
||||
if (arg[1]=='='):
|
||||
ok = ok and r_date.strftime('%Y-%m-%d')==arg[2]
|
||||
if (arg[1]=='>'):
|
||||
ok = ok and r_date.strftime('%Y-%m-%d')>arg[2]
|
||||
if (arg[1]=='<'):
|
||||
ok = ok and r_date.strftime('%Y-%m-%d')<arg[2]
|
||||
if (arg[1]=='>='):
|
||||
ok = ok and r_date.strftime('%Y-%m-%d')>=arg[2]
|
||||
if (arg[1]=='<='):
|
||||
ok = ok and r_date.strftime('%Y-%m-%d')<=arg[2]
|
||||
if not ok:
|
||||
continue
|
||||
idval = real_id2base_calendar_id(data['id'], r_date.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
result.append(idval)
|
||||
|
||||
if isinstance(select, (str, int, long)):
|
||||
return ids and ids[0] or False
|
||||
else:
|
||||
ids = list(set(result))
|
||||
return ids
|
||||
|
||||
def compute_rule_string(self, datas):
|
||||
|
@ -1243,17 +1246,17 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'week_list' : False
|
||||
}
|
||||
|
||||
def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None):
|
||||
data = self._get_empty_rrule_data()
|
||||
|
||||
if field_value:
|
||||
data['recurrency'] = True
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
rdate = rule_date or event.date
|
||||
update_data = self._parse_rrule(field_value, dict(data), rdate)
|
||||
data.update(update_data)
|
||||
#parse_rrule
|
||||
self.write(cr, uid, event.id, data, context=context)
|
||||
#def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None):
|
||||
# data = self._get_empty_rrule_data()
|
||||
#
|
||||
# if field_value:
|
||||
# data['recurrency'] = True
|
||||
# for event in self.browse(cr, uid, ids, context=context):
|
||||
# rdate = rule_date or event.date
|
||||
# update_data = self._parse_rrule(field_value, dict(data), rdate)
|
||||
# data.update(update_data)
|
||||
# #parse_rrule
|
||||
# self.write(cr, uid, event.id, data, context=context)
|
||||
|
||||
|
||||
def _parse_rrule(self, rule, data, date_start):
|
||||
|
@ -1311,9 +1314,9 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
return res
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False):
|
||||
context = context or {}
|
||||
args_without_date = []
|
||||
start_date = False
|
||||
until_date = False
|
||||
filter_date = []
|
||||
|
||||
for arg in args:
|
||||
if arg[0] == "id":
|
||||
|
@ -1323,17 +1326,18 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
elif arg[0] not in ('date', unicode('date'), 'date_deadline', unicode('date_deadline')):
|
||||
args_without_date.append(arg)
|
||||
else:
|
||||
if arg[1] in ('>', '>='):
|
||||
if start_date:
|
||||
continue
|
||||
start_date = arg[2]
|
||||
elif arg[1] in ('<', '<='):
|
||||
if until_date:
|
||||
continue
|
||||
until_date = arg[2]
|
||||
if context.get('virtual_id', True):
|
||||
args_without_date.append('|')
|
||||
args_without_date.append(arg)
|
||||
if context.get('virtual_id', True):
|
||||
args_without_date.append(('recurrency','=',1))
|
||||
filter_date.append(arg)
|
||||
|
||||
res = super(calendar_event, self).search(cr, uid, args_without_date, \
|
||||
0, 0, order, context, count=False)
|
||||
res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit, context=context)
|
||||
if context.get('virtual_id', True):
|
||||
res = self.get_recurrent_ids(cr, uid, res, args, limit, context=context)
|
||||
|
||||
if count:
|
||||
return len(res)
|
||||
elif limit:
|
||||
|
@ -1341,17 +1345,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
else:
|
||||
return res
|
||||
|
||||
def get_edit_all(self, cr, uid, id, vals=None):
|
||||
"""
|
||||
return true if we have to edit all meeting from the same recurrent
|
||||
or only on occurency
|
||||
"""
|
||||
meeting = self.read(cr,uid, id, ['edit_all', 'recurrency'] )
|
||||
if(vals and 'edit_all' in vals): #we jsut check edit_all
|
||||
return vals['edit_all']
|
||||
else: #it's a recurrent event and edit_all is already check
|
||||
return meeting['recurrency'] and meeting['edit_all']
|
||||
|
||||
def _get_data(self, cr, uid, id, context=None):
|
||||
res = self.read(cr, uid, [id],['date', 'date_deadline'])
|
||||
return res[0]
|
||||
|
@ -1370,101 +1363,63 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
if context is None:
|
||||
context = {}
|
||||
context = context or {}
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
|
||||
|
||||
|
||||
new_ids = []
|
||||
ids = [ids]
|
||||
res = False
|
||||
for event_id in select:
|
||||
|
||||
# Special write of complex IDS
|
||||
for event_id in ids[:]:
|
||||
if len(str(event_id).split('-')) == 1:
|
||||
continue
|
||||
ids.remove(event_id)
|
||||
real_event_id = base_calendar_id2real_id(event_id)
|
||||
edit_all = self.get_edit_all(cr, uid, event_id, vals=vals)
|
||||
if edit_all:
|
||||
if self.need_to_update(event_id, vals):
|
||||
res = self._get_data(cr, uid, real_event_id, context=context)
|
||||
vals.update(res)
|
||||
event_id = real_event_id
|
||||
if not vals.get('recurrency', True):
|
||||
ids.append(real_event_id)
|
||||
continue
|
||||
|
||||
#if edit one instance of a reccurrent id
|
||||
if len(str(event_id).split('-')) > 1 and not edit_all:
|
||||
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
||||
'rrule', 'duration', 'exdate'])
|
||||
if data.get('rrule'):
|
||||
data.update(vals)
|
||||
data.update({
|
||||
'recurrent_uid': real_event_id,
|
||||
'recurrent_id': data.get('date'),
|
||||
'rrule_type': 'none',
|
||||
'rrule': '',
|
||||
'edit_all': False,
|
||||
'recurrency' : False,
|
||||
})
|
||||
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
||||
'rrule', 'duration', 'exdate'])
|
||||
if data.get('rrule'):
|
||||
data.update(vals)
|
||||
data.update({
|
||||
'recurrent_uid': real_event_id,
|
||||
'recurrent_id': data.get('date'),
|
||||
'rrule_type': 'none',
|
||||
'rrule': '',
|
||||
'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 = time.strftime("%Y%m%dT%H%M%S", \
|
||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
||||
res = self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
||||
date_new = event_id.split('-')[1]
|
||||
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
||||
res = self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
||||
|
||||
context.update({'active_id': new_id, 'active_ids': [new_id]})
|
||||
continue
|
||||
if not real_event_id in new_ids:
|
||||
new_ids.append(real_event_id)
|
||||
context.update({'active_id': new_id, 'active_ids': [new_id]})
|
||||
continue
|
||||
|
||||
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
|
||||
vals['vtimezone'] = vals['vtimezone'][40:]
|
||||
|
||||
updated_vals = self.onchange_dates(cr, uid, new_ids,
|
||||
vals.get('date', False),
|
||||
vals.get('duration', False),
|
||||
vals.get('date_deadline', False),
|
||||
vals.get('allday', False),
|
||||
context=context)
|
||||
vals.update(updated_vals.get('value', {}))
|
||||
if new_ids:
|
||||
if 'rrule' in vals.keys():
|
||||
if 'date' in vals.keys():
|
||||
date_to_write = vals['date']
|
||||
else:
|
||||
date_to_write = False
|
||||
self._write_rrule(cr, uid, new_ids, vals['rrule'], date_to_write, context)
|
||||
|
||||
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
|
||||
res = super(calendar_event, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\
|
||||
or ('date' in vals or 'duration' in vals or 'date_deadline' in vals):
|
||||
# change alarm details
|
||||
alarm_obj = self.pool.get('res.alarm')
|
||||
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', context=context)
|
||||
alarm_obj.do_alarm_create(cr, uid, ids, self._name, 'date', context=context)
|
||||
return res or True and False
|
||||
|
||||
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process=None):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
select = map(lambda x: base_calendar_id2real_id(x), select)
|
||||
res = super(calendar_event, self).browse(cr, uid, select, context, \
|
||||
list_class, fields_process)
|
||||
if isinstance(ids, (str, int, long)):
|
||||
return res and res[0] or False
|
||||
|
||||
return res
|
||||
|
||||
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
if 'date' in groupby:
|
||||
raise osv.except_osv(_('Warning !'), _('Group by date not supported, use the calendar view instead'))
|
||||
virtual_id = context.get('virtual_id', False)
|
||||
virtual_id = context.get('virtual_id', True)
|
||||
context.update({'virtual_id': False})
|
||||
res = super(calendar_event, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby)
|
||||
for re in res:
|
||||
|
@ -1479,8 +1434,10 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
# FIXME This whole id mangling has to go!
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
|
||||
if fields and ('class' not in fields):
|
||||
fields.append('class')
|
||||
if fields and ('user_id' not in fields):
|
||||
fields.append('user_id')
|
||||
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
|
@ -1498,7 +1455,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
fields=fields, context=context, load=load)
|
||||
real_data = dict(zip([x['id'] for x in real_data], real_data))
|
||||
|
||||
for base_calendar_id, real_id in select:
|
||||
for base_calendar_id, real_id in select:
|
||||
res = real_data[real_id].copy()
|
||||
ls = base_calendar_id2real_id(base_calendar_id, with_date=res and res.get('duration', 0) or 0)
|
||||
if not isinstance(ls, (str, int, long)) and len(ls) >= 2:
|
||||
|
@ -1509,7 +1466,16 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
result.append(res)
|
||||
if isinstance(ids, (str, int, long)):
|
||||
return result and result[0] or False
|
||||
|
||||
|
||||
for r in result:
|
||||
if r['user_id'] and (r['user_id'][0]==uid):
|
||||
continue
|
||||
if r['class']=='private':
|
||||
for f in r.keys():
|
||||
if f not in ('id','date','date_deadline','duration','user_id','state'):
|
||||
r[f] = False
|
||||
if f=='name':
|
||||
r[f] = _('Busy')
|
||||
return result
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
|
@ -1520,68 +1486,49 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
alarm_obj = self.pool.get('res.alarm')
|
||||
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date', context=context)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
if not isinstance(ids, list):
|
||||
ids = [ids]
|
||||
|
||||
res = False
|
||||
for id in ids:
|
||||
data_list = self.read(cr, uid, [id], ['date', 'rrule', 'exdate'], context=context)
|
||||
if len(data_list) < 1:
|
||||
for event_id in ids[:]:
|
||||
if len(str(event_id).split('-')) == 1:
|
||||
continue
|
||||
event_data = data_list[0]
|
||||
event_id = event_data['id']
|
||||
|
||||
if self.get_edit_all(cr, uid, event_id, vals=None):
|
||||
event_id = base_calendar_id2real_id(event_id)
|
||||
real_event_id = base_calendar_id2real_id(event_id)
|
||||
data = self.read(cr, uid, real_event_id, ['exdate'], context=context)
|
||||
date_new = event_id.split('-')[1]
|
||||
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
||||
self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
||||
ids.remove(event_id)
|
||||
|
||||
if isinstance(event_id, (int, long)):
|
||||
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.unlink_events(cr, uid, [event_id], context=context)
|
||||
else:
|
||||
str_event, date_new = event_id.split('-')
|
||||
event_id = int(str_event)
|
||||
if event_data['rrule']:
|
||||
# Remove one of the recurrent event
|
||||
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||
exdate = (event_data['exdate'] and (event_data['exdate'] + ',') or '') + date_new
|
||||
res = self.write(cr, uid, [event_id], {'exdate': exdate})
|
||||
else:
|
||||
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.unlink_events(cr, uid, [event_id], context=context)
|
||||
res = super(calendar_event, self).unlink(cr, uid, ids, context=context)
|
||||
self.pool.get('res.alarm').do_alarm_unlink(cr, uid, ids, self._name)
|
||||
self.unlink_events(cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
|
||||
vals['vtimezone'] = vals['vtimezone'][40:]
|
||||
|
||||
if 'date' in vals and 'rrule' in vals and vals['rrule']:
|
||||
update_datas = self._parse_rrule(vals['rrule'], self._get_empty_rrule_data(), vals['date'])
|
||||
update_datas['recurrency'] = True
|
||||
vals.update(update_datas)
|
||||
|
||||
updated_vals = self.onchange_dates(cr, uid, [],
|
||||
vals.get('date', False),
|
||||
vals.get('duration', False),
|
||||
vals.get('date_deadline', False),
|
||||
vals.get('allday', False),
|
||||
context=context)
|
||||
vals.update(updated_vals.get('value', {}))
|
||||
#updated_vals = self.onchange_dates(cr, uid, [],
|
||||
# vals.get('date', False),
|
||||
# vals.get('duration', False),
|
||||
# vals.get('date_deadline', False),
|
||||
# vals.get('allday', False),
|
||||
# context=context)
|
||||
#vals.update(updated_vals.get('value', {}))
|
||||
|
||||
res = super(calendar_event, self).create(cr, uid, vals, context)
|
||||
alarm_obj = self.pool.get('res.alarm')
|
||||
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date', context=context)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def do_tentative(self, cr, uid, ids, context=None, *args):
|
||||
""" Makes event invitation as Tentative
|
||||
|
|
|
@ -242,8 +242,7 @@
|
|||
<field name="alarm_id" string="Reminder"
|
||||
widget="selection" />
|
||||
<group colspan="2" col="4" attrs="{'readonly': [('state','=','done')]}">
|
||||
<field name="recurrency"/>
|
||||
<field name="edit_all" attrs="{'invisible':[('recurrency','=', False)]}" />
|
||||
<field name="recurrency"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
!python {model: crm.meeting}: |
|
||||
from base_calendar import base_calendar
|
||||
base_cal_id = base_calendar.real_id2base_calendar_id(ref('crm_meeting_sprintreview0'), '2011-09-01 13:01:00')
|
||||
self.write(cr, uid, [base_cal_id], {'name': 'Sprint Review for google modules', 'edit_all': True})
|
||||
self.write(cr, uid, [base_cal_id], {'name': 'Sprint Review for google modules'})
|
||||
-
|
||||
I check whether all the records are edited or not.
|
||||
-
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
widget="selection" />
|
||||
<group colspan="2" col="4" attrs="{'readonly': ['|', ('recurrent_uid','!=',False), ('state','=','done')]}">
|
||||
<field name="recurrency"/>
|
||||
<field name="edit_all" attrs="{'invisible':[('recurrency','=', False)]}" />
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
|
@ -67,7 +66,7 @@
|
|||
<field name="email_from"/>
|
||||
</group><group col="2" colspan="2">
|
||||
<separator colspan="2" string="Visibility"/>
|
||||
<field name="class" string="Privacy"/>
|
||||
<field name="class" string="Privacy" groups="base.group_extended"/>
|
||||
<field name="show_as" string="Show time as" groups="base.group_extended"/>
|
||||
<field name="rrule" invisible="1" readonly="1"/>
|
||||
<field name="recurrent_id" invisible="1"/>
|
||||
|
@ -231,24 +230,11 @@
|
|||
<tree string="Meetings"
|
||||
colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')">
|
||||
<field name="name" string="Subject" />
|
||||
<field name="date" string="Start Date" />
|
||||
<field name="user_id"/>
|
||||
<field name="date"/>
|
||||
<field name="duration" />
|
||||
<field name="partner_id" string="Partner" />
|
||||
<field name="location" />
|
||||
<field name="categ_id" string="Meeting Type"/>
|
||||
<field name="class" string="Privacy"/>
|
||||
<field name="state" groups="base.group_extended"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="show_as" invisible="1" string="Show time as"/>
|
||||
<button name="case_reset" string="Reset to Unconfirmed"
|
||||
states="open,done" type="object"
|
||||
icon="gtk-convert" />
|
||||
<button name="case_open" string="Confirm"
|
||||
states="draft" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Done"
|
||||
states="open" type="object"
|
||||
icon="gtk-jump-to" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -295,7 +281,7 @@
|
|||
<search string="Search Meetings">
|
||||
<group>
|
||||
<field name="name" string="Meeting / Partner"
|
||||
domain="[('name','ilike',self), ('partner_id','ilike', self)]"/>
|
||||
filter_domain="['|', ('name','ilike',self), ('partner_id','ilike', self)]"/>
|
||||
<field name="user_id" groups="base.group_extended">
|
||||
<filter icon="terp-personal" groups="base.group_extended"
|
||||
domain="[('user_id','=',uid)]"
|
||||
|
|
|
@ -40,6 +40,13 @@
|
|||
<record model="ir.ui.menu" id="base.menu_base_config">
|
||||
<field eval="[(4, ref('base.group_sale_manager'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="crm_meeting_global" model="ir.rule">
|
||||
<field name="name">Hide Private Meetings</field>
|
||||
<field ref="model_crm_meeting" name="model_id"/>
|
||||
<field eval="1" name="global"/>
|
||||
<field name="domain_force">['|',('user_id','=',user.id),('show_as','=','busy')]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="act_hr_evaluation_tree" model="ir.actions.act_window">
|
||||
<field name="name">My Appraisal Remaining</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr_evaluation.evaluation</field>
|
||||
<record model="ir.actions.act_window" id="action_hr_evaluation_interview_board">
|
||||
<field name="name">Interview Requests</field>
|
||||
<field name="res_model">hr.evaluation.interview</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="domain">[('state','in',('wait', 'progress')),('create_uid','=',uid)]</field>
|
||||
<field name="search_view_id" ref="hr_evaluation.view_hr_evaluation_tree"/>
|
||||
<field name="domain">[('is_evaluation' ,'=', True), ('user_id', '=', uid),('state','=','waiting_answer')]</field>
|
||||
<field name="search_view_id" ref="view_hr_evaluation_interview_search"/>
|
||||
</record>
|
||||
|
||||
<record id="board_hr_evaluation_form" model="ir.ui.view">
|
||||
|
@ -18,7 +17,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/board/column[1]" position="inside">
|
||||
<action name="%(act_hr_evaluation_tree)d" string="My Appraisal Remaining"/>
|
||||
<action name="%(action_hr_evaluation_interview_board)d" string="Interview Requests"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -365,7 +365,7 @@
|
|||
</record>
|
||||
|
||||
<record id="view_evaluation_calendar" model="ir.ui.view">
|
||||
<field name="name">Interview Request</field>
|
||||
<field name="name">Interview Requests</field>
|
||||
<field name="model">hr.evaluation.interview</field>
|
||||
<field name="type">calendar</field>
|
||||
<field name="arch" type="xml">
|
||||
|
@ -379,7 +379,7 @@
|
|||
<field name="name">Interview Requests</field>
|
||||
<field name="res_model">hr.evaluation.interview</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_hr_evaluation_interview_form"/>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="domain">[('is_evaluation' ,'=', True)]</field>
|
||||
<field name="context">{'default_is_evaluation': True, "search_default_todo":1,"search_default_user_id":uid}</field>
|
||||
<field name="search_view_id" ref="view_hr_evaluation_interview_search"/>
|
||||
|
|
Loading…
Reference in New Issue