[IMP,FIX]: caldav, crm: Fixed problem of importing alarm and attendee in meeting
bzr revid: rpa@openerp.co.in-20100113103536-w2djn19aca8rm063
This commit is contained in:
parent
80f534817c
commit
d95b47c647
|
@ -161,12 +161,12 @@ class CalDAV(object):
|
|||
if cal_data.name.lower() == 'attendee':
|
||||
attendee = self.pool.get('basic.calendar.attendee')
|
||||
att_data.append(attendee.import_ical(cr, uid, cal_data))
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
self.ical_set(cal_data.name.lower(), att_data, 'value')
|
||||
continue
|
||||
if cal_data.name.lower() == 'valarm':
|
||||
alarm = self.pool.get('basic.calendar.alarm')
|
||||
vals = alarm.import_ical(cr, uid, cal_data)
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
self.ical_set(cal_data.name.lower(), vals, 'value')
|
||||
continue
|
||||
if cal_data.name.lower() in self.__attribute__:
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
from tools.translate import _
|
||||
|
@ -32,7 +32,7 @@ months = {
|
|||
5:"May", 6:"June", 7:"July", 8:"August", 9:"September", \
|
||||
10:"October", 11:"November", 12:"December"}
|
||||
|
||||
def caldav_id2real_id(caldav_id = None, with_date=False):
|
||||
def caldav_id2real_id(caldav_id=None, with_date=False):
|
||||
if caldav_id and isinstance(caldav_id, (str, unicode)):
|
||||
res = caldav_id.split('-')
|
||||
if len(res) >= 2:
|
||||
|
@ -135,24 +135,30 @@ class calendar_attendee(osv.osv):
|
|||
fromdata = map(get_delegate_data, attdata.del_from_user_ids)
|
||||
result[id][name] = ', '.join(fromdata)
|
||||
if name == 'event_date':
|
||||
# TO fix date for project task
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['date'])[0]
|
||||
result[id][name] = obj['date']
|
||||
result[id][name] = None#obj['date']
|
||||
else:
|
||||
result[id][name] = None
|
||||
if name == 'event_end_date':
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['date_deadline'])[0]
|
||||
result[id][name] = obj['date_deadline']
|
||||
|
||||
else:
|
||||
result[id][name] = None
|
||||
if name == 'sent_by_uid':
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['user_id'])[0]
|
||||
result[id][name] = obj['user_id']
|
||||
else:
|
||||
result[id][name] = uid
|
||||
return result
|
||||
|
||||
def _links_get(self, cr, uid, context={}):
|
||||
|
@ -319,11 +325,11 @@ or contains the text to be used for display"""),
|
|||
if event_date:
|
||||
dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S")
|
||||
if vals['trigger_interval'] == 'days':
|
||||
delta = datetime.timedelta(days=vals['trigger_duration'])
|
||||
delta = timedelta(days=vals['trigger_duration'])
|
||||
if vals['trigger_interval'] == 'hours':
|
||||
delta = datetime.timedelta(hours=vals['trigger_duration'])
|
||||
delta = timedelta(hours=vals['trigger_duration'])
|
||||
if vals['trigger_interval'] == 'minutes':
|
||||
delta = datetime.timedelta(minutes=vals['trigger_duration'])
|
||||
delta = timedelta(minutes=vals['trigger_duration'])
|
||||
trigger_date = dtstart + (vals['trigger_occurs'] == 'after' and delta or -delta)
|
||||
vals['trigger_date'] = trigger_date
|
||||
res = super(calendar_alarm, self).create(cr, uid, vals, context)
|
||||
|
|
|
@ -113,9 +113,16 @@ class crm_meeting(osv.osv):
|
|||
return {'value': {'rrule': rrulestr}}
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Description', size=64, required=True),
|
||||
'section_id': fields.many2one('crm.case.section', 'Section', select=True, help='Section to which Case belongs to. Define Responsible user and Email \
|
||||
account for mail gateway.'),
|
||||
'priority': fields.selection([('5','Lowest'),
|
||||
('4','Low'),
|
||||
('3','Normal'),
|
||||
('2','High'),
|
||||
('1','Highest')
|
||||
], 'Priority'),
|
||||
'date': fields.datetime('Date'),
|
||||
'date_deadline': fields.datetime('Deadline'),
|
||||
'duration': fields.function(_get_duration, method=True, \
|
||||
|
@ -125,6 +132,7 @@ account for mail gateway.'),
|
|||
help='Category related to the section.Subdivide the CRM cases \
|
||||
independently or section-wise.'),
|
||||
'description': fields.text('Your action'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
|
||||
('confidential', 'Confidential')], 'Mark as'),
|
||||
'location': fields.char('Location', size=264, help="Location of Meeting"),
|
||||
|
@ -140,7 +148,7 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
'rrule_type': fields.selection([('none', 'None'), ('daily', 'Daily'), \
|
||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||
('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'crm_attendee_rel', 'case_id', 'attendee_id', 'Attendees'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'crm_attendee_rel', 'case_id', 'attendee_id', 'Attendees'),
|
||||
'alarm_id': fields.many2one('res.alarm', 'Alarm'),
|
||||
'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
|
||||
}
|
||||
|
@ -221,6 +229,14 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
file_content = base64.decodestring(data)
|
||||
event_obj = self.pool.get('basic.calendar.event')
|
||||
event_obj.__attribute__.update(self.__attribute__)
|
||||
|
||||
attendee_obj = self.pool.get('basic.calendar.attendee')
|
||||
attendee = self.pool.get('calendar.attendee')
|
||||
attendee_obj.__attribute__.update(attendee.__attribute__)
|
||||
|
||||
alarm_obj = self.pool.get('basic.calendar.alarm')
|
||||
alarm = self.pool.get('calendar.alarm')
|
||||
alarm_obj.__attribute__.update(alarm.__attribute__)
|
||||
|
||||
vals = event_obj.import_ical(cr, uid, file_content)
|
||||
ids = []
|
||||
|
@ -337,8 +353,6 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
id = common.caldav_id2real_id(id)
|
||||
if not id in new_ids:
|
||||
new_ids.append(id)
|
||||
if 'case_id' in vals:
|
||||
vals['case_id'] = common.caldav_id2real_id(vals['case_id'])
|
||||
res = super(crm_meeting, self).write(cr, uid, new_ids, vals, context=context)
|
||||
self.do_alarm_create(cr, uid, new_ids)
|
||||
return res
|
||||
|
@ -399,13 +413,12 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
res = super(crm_meeting, self).unlink(cr, uid, common.caldav_id2real_id(ids))
|
||||
self.do_alarm_unlink(cr, uid, ids)
|
||||
else:
|
||||
ids = map(lambda x: common.caldav_id2real_id(x), ids)
|
||||
res = super(crm_meeting, self).unlink(cr, uid, ids)
|
||||
self.do_alarm_unlink(cr, uid, ids)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
if 'case_id' in vals:
|
||||
vals['case_id'] = common.caldav_id2real_id(vals['case_id'])
|
||||
res = super(crm_meeting, self).create(cr, uid, vals, context)
|
||||
self.do_alarm_create(cr, uid, [res])
|
||||
return res
|
||||
|
|
|
@ -124,7 +124,6 @@
|
|||
<field name="section_id" widget="selection"/>
|
||||
<field name="priority"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="category2_id" string="Type"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Confirm Meeting" states="draft,cancel,pending" type="object" icon="terp-crm"/>
|
||||
|
|
Loading…
Reference in New Issue