From b034fc865d33b3d4bed9a54f116047b982da380a Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Mon, 18 Jan 2010 16:37:30 +0530 Subject: [PATCH 1/3] [IMP]: caldav, crm: Improvement for importing recurrent meetings with same uid bzr revid: rpa@openerp.co.in-20100118110730-c57780xdyjyug6by --- addons/caldav/common.py | 17 ++++++++++++----- addons/crm/crm_meeting.py | 13 +++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/addons/caldav/common.py b/addons/caldav/common.py index 77187c91419..2119584a399 100644 --- a/addons/caldav/common.py +++ b/addons/caldav/common.py @@ -51,19 +51,26 @@ def real_id2caldav_id(real_id, recurrent_date): return '%d-%s'%(real_id, recurrent_date) return real_id -def uid2openobjectid(cr, uidval, oomodel): +def uid2openobjectid(cr, uidval, oomodel, rdate): __rege = re.compile(r'OpenObject-([\w|\.]+)_([0-9]+)@(\w+)$') wematch = __rege.match(uidval.encode('utf8')) if not wematch: - return False + return (False, None) else: model, id, dbname = wematch.groups() if (not model == oomodel) or (not dbname == cr.dbname): - return False - cr.execute('select distinct(id) from %s' % model.replace('.', '_')) + return (False, None) + qry = 'select distinct(id) from %s' % model.replace('.', '_') + if rdate: + qry += " where recurrent_id='%s'" % (rdate) + cr.execute(qry) + r_id = cr.fetchone() + if r_id: + return (id, r_id[0]) + cr.execute(qry) ids = map(lambda x: str(x[0]), cr.fetchall()) if id in ids: - return id + return (id, None) return False def openobjectid2uid(cr, uidval, oomodel): diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index 27d744c38d2..d73823bd710 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -194,13 +194,18 @@ rule or repeating pattern for anexception to a recurrence set"), vals = event_obj.import_ical(cr, uid, file_content) ids = [] for val in vals: - is_exists = common.uid2openobjectid(cr, val['id'], self._name) + exists, r_id = common.uid2openobjectid(cr, val['id'], self._name, \ + val.get('recurrent_id')) if val.has_key('create_date'): val.pop('create_date') val['caldav_url'] = context.get('url') or '' val.pop('id') - if is_exists: - self.write(cr, uid, [is_exists], val) - ids.append(is_exists) + if exists and r_id: + val.update({'recurrent_uid': exists}) + self.write(cr, uid, [r_id], val) + ids.append(r_id) + elif exists: + self.write(cr, uid, [exists], val) + ids.append(exists) else: case_id = self.create(cr, uid, val) ids.append(case_id) From f0661cc5f70ffa7ea6e86573f57b7ef1c4dff732 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 20:26:57 +0530 Subject: [PATCH 2/3] [REF] Account: Terp improved bzr revid: jvo@tinyerp.com-20100118145657-uzcxznc5l6b0gj71 --- addons/account/__terp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index d6465027059..c7f1dc9e149 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -21,7 +21,7 @@ { - "name" : "Accounting and financial management", + "name" : "Accounting and Financial Management", "version" : "1.1", "depends" : ["product", "base", "process"], "author" : "Tiny", From f1918969ee73de516c55b6894138ddae2fb76ce8 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 20:44:10 +0530 Subject: [PATCH 3/3] [FIX] Hr_attendance : Button action calling corrected bzr revid: jvo@tinyerp.com-20100118151410-maj5xsc2lsf8f9e0 --- addons/hr_attendance/hr_attendance.py | 8 ++++++-- addons/hr_attendance/hr_attendance_view.xml | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 2161f0886b1..8994f96de4a 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -114,7 +114,11 @@ class hr_employee(osv.osv): def attendance_action_change(self, cr, uid, ids, type='action', context={}, dt=False, *args): id = False warning_sign = 'sign' - + + #Special case when button calls this method :type=context + if isinstance(type,dict): + type = type.get('type','action') + if type == 'sign_in': warning_sign = "Sign In" elif type == 'sign_out': @@ -125,7 +129,7 @@ class hr_employee(osv.osv): raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the administrator to correct attendances.')%(warning_sign,)) res = {'action' : type, 'employee_id' : emp['id']} - + if dt: res['name'] = dt diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml index 2511d76b1f5..6bfedddd3b5 100644 --- a/addons/hr_attendance/hr_attendance_view.xml +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -99,8 +99,8 @@ -