From d7f41730a82a04eab1faf414f646629d9fc3583b Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Tue, 13 Jul 2010 12:51:49 +0530 Subject: [PATCH] [FIX] calendar: send invitation with correct ics file and fixed problem in project caldev bzr revid: hmo@tinyerp.com-20100713072149-ltjnywgg4g142x61 --- addons/base_calendar/base_calendar.py | 15 ++++++++------- addons/project_caldav/project_caldav.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index f66cd0ca463..cc24d131e39 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -409,6 +409,7 @@ property or property parameter."), return res cal = vobject.iCalendar() event = cal.add('vevent') + event.add('uid').value = 'OpenObject-%s_%s@%s' % (event_obj._name, event_obj.id, cr.dbname) 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('dtend').value = ics_datetime(event_obj.date_deadline) @@ -546,13 +547,13 @@ property or property parameter."), context = {} for vals in self.browse(cr, uid, ids, context=context): - #user = vals.user_id - #if user: - # mod_obj = self.pool.get(vals.ref._name) - # if vals.ref: - # if vals.ref.user_id.id != user.id: - # defaults = {'user_id': user.id} - # new_event = mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) + user = vals.user_id + if user: + mod_obj = self.pool.get(vals.ref._name) + if vals.ref: + if vals.ref.user_id.id != user.id: + defaults = {'user_id': user.id} + new_event = mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) return True diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py index b6a87516194..65e61c6e4cd 100644 --- a/addons/project_caldav/project_caldav.py +++ b/addons/project_caldav/project_caldav.py @@ -30,7 +30,13 @@ class project_task(osv.osv): 'create_date': fields.datetime('Create Date'), 'attendee_ids': fields.many2many('calendar.attendee', \ 'task_attendee_rel', 'task_id', 'attendee_id', 'Attendees'), - } + 'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True, + help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\ + \n If the task is over, the states is set to \'Done\'.'), + } + _defaults = { + 'state': 'draft', + } def import_cal(self, cr, uid, data, data_id=None, context=None): todo_obj = self.pool.get('basic.calendar.todo') @@ -43,7 +49,7 @@ class project_task(osv.osv): ids = [] for val in vals: obj_tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode_id - if not val.has_key('planned_hours'): + if not val.get('planned_hours', False): # 'Computes duration' in days plan = 0.0 if val.get('date') and val.get('date_deadline'):