From 459fb2a5c128a78200ffd6c99e0a155ab425fc97 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Thu, 11 Feb 2010 15:23:30 +0530 Subject: [PATCH] [IMP] caldav: Improve view bzr revid: hmo@tinyerp.com-20100211095330-8o8xhdl5i9pcf7le --- addons/caldav/caldav.py | 14 +++++------ addons/caldav/caldav_view.xml | 15 ++++++------ addons/crm/crm_meeting_view.xml | 9 ++++---- addons/crm_caldav/crm_meeting.py | 32 ++++++++++++++++++++++---- addons/crm_caldav/crm_meeting_view.xml | 25 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/addons/caldav/caldav.py b/addons/caldav/caldav.py index dc21e1b345b..f2cd5f90163 100644 --- a/addons/caldav/caldav.py +++ b/addons/caldav/caldav.py @@ -314,7 +314,7 @@ class calendar_attendee(osv.osv): obj = model_obj.read(cr, uid, res_id, ['date'])[0] result[id][name] = obj.get('date') else: - result[id][name] = None + result[id][name] = False if name == 'event_end_date': if attdata.ref: model, res_id = tuple(attdata.ref.split(',')) @@ -322,7 +322,7 @@ class calendar_attendee(osv.osv): obj = model_obj.read(cr, uid, res_id, ['date_deadline'])[0] result[id][name] = obj.get('date_deadline') else: - result[id][name] = None + result[id][name] = False if name == 'sent_by_uid': if attdata.ref: model, res_id = tuple(attdata.ref.split(',')) @@ -353,8 +353,8 @@ class calendar_attendee(osv.osv): _columns = { 'cutype': fields.selection([('individual', 'Individual'), \ ('group', 'Group'), ('resource', 'Resource'), \ - ('room', 'Room'), ('unknown', 'Unknown') ], \ - 'User Type', help="Specify the type of calendar user"), + ('room', 'Room'), ('unknown', '') ], \ + 'Invite Type', help="Specify the type of Invitation"), 'member': fields.char('Member', size=124, help="Indicate the groups that the attendee belongs to"), 'role': fields.selection([('req-participant', 'Participation required'), \ @@ -438,7 +438,7 @@ request was delegated to"), att2.email) + ' - Status: ' + att2.state.title()) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, - 'end_date': res_obj.date_deadline or None, + 'end_date': res_obj.date_deadline or False, 'description': res_obj.description or '-', 'location': res_obj.location or '-', 'attendees': '
'.join(att_infos), @@ -737,7 +737,7 @@ defines the list of date/time exceptions for arecurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="defines a \ rule or repeating pattern for anexception to a recurrence set"), 'rrule': fields.char('Recurrent Rule', size=124), - 'rrule_type': fields.selection([('none', 'None'), ('daily', 'Daily'), \ + 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'), 'alarm_id': fields.many2one('res.alarm', 'Alarm'), @@ -745,7 +745,7 @@ rule or repeating pattern for anexception to a recurrence set"), 'recurrent_uid': fields.integer('Recurrent ID'), 'recurrent_id': fields.datetime('Recurrent ID date'), 'vtimezone': fields.selection(_tz_get, 'Timezone', size=64), - 'user_id': fields.many2one('res.users', 'Responsible'), + 'user_id': fields.many2one('res.users', 'Responsible'), } _defaults = { diff --git a/addons/caldav/caldav_view.xml b/addons/caldav/caldav_view.xml index 32038d3e3ee..2956b00d585 100644 --- a/addons/caldav/caldav_view.xml +++ b/addons/caldav/caldav_view.xml @@ -62,7 +62,7 @@ calendar.attendee form -
+ @@ -70,11 +70,11 @@ - + - + @@ -117,10 +117,11 @@ calendar.attendee tree - - - - + + + + + diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 5591297d9be..fb1e42fe167 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -28,7 +28,7 @@ - + @@ -75,11 +75,12 @@ - - + + - + + diff --git a/addons/crm_caldav/crm_meeting.py b/addons/crm_caldav/crm_meeting.py index 137d19e141a..b7ec46fb4f6 100644 --- a/addons/crm_caldav/crm_meeting.py +++ b/addons/crm_caldav/crm_meeting.py @@ -29,11 +29,9 @@ class crm_meeting(osv.osv): _columns = { 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), - 'categ_id': fields.many2one('crm.case.categ', 'Category', \ - domain="[('section_id','=',section_id),\ - ('object_id.model', '=', 'crm.meeting')]", \ - help='Category related to the section.Subdivide the CRM cases \ -independently or section-wise.'), + 'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \ + domain="[('object_id.model', '=', 'crm.meeting')]", \ + ), 'phonecall_id':fields.many2one ('crm.phonecall', 'Phonecall'), 'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'), 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', 'event_id', 'attendee_id', 'Attendees'), @@ -41,4 +39,28 @@ independently or section-wise.'), crm_meeting() +class calendar_attendee(osv.osv): + _inherit = 'calendar.attendee' + + def _compute_data(self, cr, uid, ids, name, arg, context): + name = name[0] + result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context) + + for attdata in self.browse(cr, uid, ids, context=context): + id = attdata.id + result[id] = {} + if name == 'categ_id': + if attdata.ref: + model, res_id = tuple(attdata.ref.split(',')) + model_obj = self.pool.get(model) + obj = model_obj.read(cr, uid, res_id, ['categ_id'])[0] + result[id][name] = obj.get('categ_id') + else: + result[id][name] = False + return result + _columns = { + 'categ_id': fields.function(_compute_data, method=True, string='Event Type', type="many2one", relation="crm.case.categ", multi='categ_id'), + } +calendar_attendee() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_caldav/crm_meeting_view.xml b/addons/crm_caldav/crm_meeting_view.xml index edd0e3c3572..56eccd606cd 100644 --- a/addons/crm_caldav/crm_meeting_view.xml +++ b/addons/crm_caldav/crm_meeting_view.xml @@ -100,6 +100,31 @@ + + + + calendar.attendee.form.inherit + calendar.attendee + form + + + + + + + + + + calendar.attendee.tree.inherit + calendar.attendee + tree + + + + + + +