From c2310c8ec915eacb66fa4dc14c4f5eeedba88fec Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 19 Jan 2011 11:10:36 +0530 Subject: [PATCH 01/17] [FIX]: Fix date not defined problem. bzr revid: atp@tinyerp.com-20110119054036-kowoc9x61g5179ir --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 5bc12c69671..0f5848c286e 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -19,7 +19,7 @@ # ############################################################################## -from datetime import datetime, timedelta +from datetime import datetime, timedelta, date from dateutil import parser from dateutil import rrule from osv import fields, osv From 09c20f3890b24cbb165d563a57b574efd376be34 Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Wed, 19 Jan 2011 12:56:54 +0530 Subject: [PATCH 02/17] [Fix] crm: make the readonly rrule bzr revid: sbh@tinyerp.com-20110119072654-yy1umehx10oy7s1k --- addons/crm/crm_meeting_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 960f83e43c9..aa74b0c91c5 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -70,7 +70,7 @@ - + From b965ec4ad094b4523c5bba96f5db57d923dd042a Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Wed, 19 Jan 2011 13:34:30 +0530 Subject: [PATCH 03/17] [FIX] base_calendar : TFR changes reverted bzr revid: sbh@tinyerp.com-20110119080430-feb2kpnys7nl7rgn --- addons/base_calendar/base_calendar.py | 62 ++++++++------------------- 1 file changed, 17 insertions(+), 45 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 0f5848c286e..98aea630ef1 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -19,7 +19,7 @@ # ############################################################################## -from datetime import datetime, timedelta, date +from datetime import datetime, timedelta from dateutil import parser from dateutil import rrule from osv import fields, osv @@ -30,7 +30,6 @@ import re import time import tools - months = { 1: "January", 2: "February", 3: "March", 4: "April", \ 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", \ @@ -1081,6 +1080,8 @@ class calendar_event(osv.osv): for datas in self.read(cr, uid, ids, context=context): event = datas['id'] if datas.get('rrule_type'): + if datas['rrule_type']=='daily_working': + datas.update({'rrule_type': 'weekly'}) if datas.get('rrule_type') == 'none': result[event] = False cr.execute("UPDATE %s set exrule=Null where id=%%s" % self._table,( event,)) @@ -1266,8 +1267,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ until_date = base_until_date and datetime.strptime(base_until_date[:10]+ ' 23:59:59', "%Y-%m-%d %H:%M:%S") or False if count > limit: break - if not data['date']: - 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 start_date = event_date @@ -1401,9 +1400,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ continue until_date = arg[2] res = super(calendar_event, self).search(cr, uid, args_without_date, \ - offset, limit, order, context, count=False) + offset, limit, order, context, count) + res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) - return len(res) if count else res + return res def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ @@ -1415,7 +1415,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ @param vals: Dictionary of field value. @param context: A standard dictionary for contextual values @return: True - """ + """ if context is None: context = {} if isinstance(ids, (str, int, long)): @@ -1425,26 +1425,19 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ new_ids = [] res = False for event_id in select: - real_event_id = base_calendar_id2real_id(event_id) - - event = self.browse(cr,uid, event_id, context=context) - if('edit_all' in vals): - edit_all = vals['edit_all'] - else: - edit_all = event.edit_all or not event.recurrency - - if not edit_all: + real_event_id = base_calendar_id2real_id(event_id) + if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) if data.get('rrule'): - data.update(vals) data.update({ + 'recurrent_uid': real_event_id, + 'recurrent_id': data.get('date'), 'rrule_type': 'none', 'rrule': '' }) - + data.update(vals) new_id = self.copy(cr, uid, real_event_id, default=data, context=context) - self.unlink(cr, uid, [event_id], context=context) context.update({'active_id': new_id, 'active_ids': [new_id]}) continue if not real_event_id in new_ids: @@ -1461,7 +1454,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ context=context) vals.update(updated_vals.get('value', {})) - if new_ids: res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) @@ -1523,8 +1515,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ for base_calendar_id, real_id in select: #REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) - if not res: - res = {} 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: res['date'] = ls[1] @@ -1563,30 +1553,21 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ @return: True """ res = False - for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate', 'edit_all'], context=context): + for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context): event_id = event_datas['id'] - edit_all = event_datas.get('edit_all', False) 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: - select = event_id.split('-') - if(len(select) < 2): - str_event = event_id - date_new = time.strftime("%Y%m%d%H%M%S", \ - time.strptime(event_datas['date'], "%Y-%m-%d %H:%M:%S")) - else: - str_event, date_new = select - - + str_event, date_new = event_id.split('-') event_id = int(str_event) - if event_datas['rrule'] and not edit_all: + if event_datas['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_datas['exdate'] and (event_datas['exdate'] + ',') or '') + date_new - res = super(calendar_event, self).write(cr, uid, [event_id], {'exdate': exdate}) + 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) @@ -1620,9 +1601,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 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) - records = self.browse(cr, uid, [res], context=context) - #return real_id2base_calendar_id(records[0].id, records[0].date) - return base_calendar_id2real_id(records[0].id) + return res def do_tentative(self, cr, uid, ids, context=None, *args): """ Makes event invitation as Tentative @@ -1745,13 +1724,6 @@ class ir_attachment(osv.osv): return super(ir_attachment, self).search(cr, uid, new_args, offset=offset, limit=limit, order=order, context=context, count=False) - - def create(self, cr, uid, vals, context=None): - if context: - id = context.get('default_res_id', False) - context.update({'default_res_id' : base_calendar_id2real_id(id)}) - return super(ir_attachment, self).create(cr, uid, vals, context=context) - ir_attachment() class ir_values(osv.osv): From 9913744c25d9a16f022772e827d96e3d9bb56163 Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Wed, 19 Jan 2011 13:38:26 +0530 Subject: [PATCH 04/17] [FIX] base_caelndar : import date added fixed bzr revid: sbh@tinyerp.com-20110119080826-72867u082nclm4al --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 98aea630ef1..5567a5583b5 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -19,7 +19,7 @@ # ############################################################################## -from datetime import datetime, timedelta +from datetime import datetime, timedelta, date from dateutil import parser from dateutil import rrule from osv import fields, osv From cfae76c87640b1548b3890580406a147e1d606b6 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Wed, 19 Jan 2011 18:40:55 +0530 Subject: [PATCH 05/17] [FIX] crm: Recurrent meetings should not be allowed to set recurrent again. bzr revid: uco@tinyerp.com-20110119131055-qj9yg4y2d96gwka6 --- addons/crm/crm_meeting_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index aa74b0c91c5..3ae0a49e72d 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -43,7 +43,7 @@ - + @@ -165,7 +165,7 @@ - + From 62a08860f4bcc9489dd678e7741f6bb16203dcf1 Mon Sep 17 00:00:00 2001 From: jam-openerp Date: Thu, 20 Jan 2011 11:16:30 +0530 Subject: [PATCH 06/17] [IMP] project_long_term : Resource allocation Scheduling Warning Message Improved bzr revid: jam@tinyerp.com-20110120054630-5iat436nbtuj9p62 --- addons/project_long_term/project_long_term.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 0e605ed4331..f8b91a200b5 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -368,7 +368,7 @@ def Phase_%d(): try: phase = Task.BalancedProject(Phase) except : - raise osv.except_osv(_('Error !'),_('Phase Scheduling is not possible.\nProject should have the Start date and member for scheduling.')) + raise osv.except_osv(_('Error !'),_('Invalid Project Members.\nPhase Scheduling is not possible.')) for task_id in task_ids: @@ -515,7 +515,7 @@ def Project_%d(): try: project = Task.BalancedProject(Project) except : - raise osv.except_osv(_('Error !'),_('Phase Scheduling is not possible.\nProject should have the Start date and member for scheduling.')) + raise osv.except_osv(_('Error !'),_('Invalid Project Members.\nPhase Scheduling is not possible.')) for phase_id in phase_ids: act_phase = phase_pool.browse(cr, uid, phase_id, context=context) From 721ef0e7b05d8e382b42e8d2e549acbebbc909c4 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Thu, 20 Jan 2011 11:23:01 +0530 Subject: [PATCH 07/17] [REF] base_calendar: Removed unnecessary code. bzr revid: uco@tinyerp.com-20110120055301-ywx2xqm37kdu0zl9 --- addons/base_calendar/base_calendar.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 5567a5583b5..3e80fae913e 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1080,8 +1080,6 @@ class calendar_event(osv.osv): for datas in self.read(cr, uid, ids, context=context): event = datas['id'] if datas.get('rrule_type'): - if datas['rrule_type']=='daily_working': - datas.update({'rrule_type': 'weekly'}) if datas.get('rrule_type') == 'none': result[event] = False cr.execute("UPDATE %s set exrule=Null where id=%%s" % self._table,( event,)) From 0e11334e1df7a02df8e72806b7ea058c50a9249b Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 11:19:39 +0100 Subject: [PATCH 08/17] [IMP] edit_all recurrent_meeting bzr revid: tfr@openerp.com-20110120101939-r4cx5embio608vdr --- addons/base_calendar/base_calendar.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 3e80fae913e..e4134fecdee 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1402,6 +1402,20 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) return res + + def get_edit_all(self, cr, uid, id, vals=None, context=None): + """ + return true if we have to edit all meeting from the same recurrent + or only on occurency + """ + + meeting = self.browse(cr,uid,[id], context=context) + if(vals and 'edit_all' in vals): #we jsut check edit_all + return edit_all = vals['edit_all'] + else: #it's a recurrent event and edit_all is already check + return edit_all = meeting.recurrency and meeting.edit_all + + def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ @@ -1424,6 +1438,11 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = False for event_id in select: real_event_id = base_calendar_id2real_id(event_id) + + if(self.get_edit_all(cr, uid, id, vals=vals, context=context)edit_all): + event_id = real_event_id + + if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) @@ -1553,6 +1572,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = False for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context): event_id = event_datas['id'] + + if(self.get_edit_all(self, cr, uid, event_id, vals=None, context=context): + event_id = base_calendar_id2real_id(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) From dec6023b2b1a1f8abb4c436208bb55c9078b9f29 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 11:28:29 +0100 Subject: [PATCH 09/17] [FIX] unlink call get_all error bzr revid: tfr@openerp.com-20110120102829-d8i0uk3fz4xfbxww --- addons/base_calendar/base_calendar.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 3e80fae913e..eb168c3bfe4 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1402,6 +1402,20 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) return res + + def get_edit_all(self, cr, uid, id, vals=None, context=None): + """ + return true if we have to edit all meeting from the same recurrent + or only on occurency + """ + + meeting = self.browse(cr,uid,[id], context=context) + 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 write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): """ @@ -1424,6 +1438,11 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = False for event_id in select: real_event_id = base_calendar_id2real_id(event_id) + + if(self.get_edit_all(cr, uid, id, vals=vals, context=context)): + event_id = real_event_id + + if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) @@ -1553,6 +1572,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = False for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context): event_id = event_datas['id'] + + if self.get_edit_all(cr, uid, event_id, vals=None, context=context): + event_id = base_calendar_id2real_id(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) From 3f1ca7e1aee90b6e65d92bd53e1c08a619a99c84 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 11:36:31 +0100 Subject: [PATCH 10/17] [FIX] unlink call get_all error bzr revid: tfr@openerp.com-20110120103631-13x8718s8a5ivb62 --- addons/base_calendar/base_calendar.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index eb168c3bfe4..a1e4293eaf9 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1403,17 +1403,17 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) return res - def get_edit_all(self, cr, uid, id, vals=None, context=None): + 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.browse(cr,uid,[id], context=context) + print id + 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 + return meeting['recurrency'] and meeting['edit_all'] @@ -1439,7 +1439,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ for event_id in select: real_event_id = base_calendar_id2real_id(event_id) - if(self.get_edit_all(cr, uid, id, vals=vals, context=context)): + if(self.get_edit_all(cr, uid, event_id, vals=vals)): event_id = real_event_id @@ -1573,7 +1573,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context): event_id = event_datas['id'] - if self.get_edit_all(cr, uid, event_id, vals=None, context=context): + if self.get_edit_all(cr, uid, event_id, vals=None): event_id = base_calendar_id2real_id(event_id) if isinstance(event_id, (int, long)): From 9d24c3cdf4167fd932600d6fd4bcb01090dfa2fb Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 12:02:25 +0100 Subject: [PATCH 11/17] [FIX] unlink call get_all error bzr revid: tfr@openerp.com-20110120110225-lvul0x0gw3pnu4rp --- addons/base_calendar/base_calendar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index a1e4293eaf9..93c92acf342 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1532,6 +1532,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ for base_calendar_id, real_id in select: #REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) + if not res : + res = {} 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: res['date'] = ls[1] From f689864de12dc6a7129d65364f95b6e7d8bd2e83 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 12:38:33 +0100 Subject: [PATCH 12/17] [FIX] deletion of a replica exdate bzr revid: tfr@openerp.com-20110120113833-p4sf9ehkdqv32w3h --- addons/base_calendar/base_calendar.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 93c92acf342..8f92c385849 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1198,6 +1198,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'active': 1, 'user_id': lambda self, cr, uid, ctx: uid, 'organizer': default_organizer, + 'edit_all' : True, } def onchange_edit_all(self, cr, uid, ids, rrule_type,edit_all, context=None): @@ -1408,7 +1409,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ return true if we have to edit all meeting from the same recurrent or only on occurency """ - print id 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'] @@ -1445,16 +1445,24 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ if len(str(event_id).split('-')) > 1: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ - 'rrule', 'duration']) + 'rrule', 'duration', 'exdate']) if data.get('rrule'): data.update({ 'recurrent_uid': real_event_id, 'recurrent_id': data.get('date'), 'rrule_type': 'none', - 'rrule': '' + 'rrule': '', + 'edit_all': False, }) data.update(vals) 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}) + context.update({'active_id': new_id, 'active_ids': [new_id]}) continue if not real_event_id in new_ids: From 7a352a05286ecd4288b6f3508f958575714f42c6 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 12:46:05 +0100 Subject: [PATCH 13/17] [MERGE] bzr revid: tfr@openerp.com-20110120114605-hhm706qwco5gma8v --- addons/base_calendar/base_calendar.py | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 48409de4cd2..c7381b196a3 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1404,33 +1404,18 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) return res -<<<<<<< TREE + def get_edit_all(self, cr, uid, id, vals=None): -======= - def get_edit_all(self, cr, uid, id, vals=None, context=None): ->>>>>>> MERGE-SOURCE """ return true if we have to edit all meeting from the same recurrent or only on occurency """ -<<<<<<< TREE meeting = self.read(cr,uid, id, ['edit_all', 'recurrency'] ) -======= - - meeting = self.browse(cr,uid,[id], context=context) ->>>>>>> MERGE-SOURCE if(vals and 'edit_all' in vals): #we jsut check edit_all -<<<<<<< TREE return vals['edit_all'] -======= - return edit_all = vals['edit_all'] ->>>>>>> MERGE-SOURCE else: #it's a recurrent event and edit_all is already check -<<<<<<< TREE return meeting['recurrency'] and meeting['edit_all'] -======= - return edit_all = meeting.recurrency and meeting.edit_all ->>>>>>> MERGE-SOURCE + @@ -1601,11 +1586,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context): event_id = event_datas['id'] -<<<<<<< TREE if self.get_edit_all(cr, uid, event_id, vals=None): -======= - if(self.get_edit_all(self, cr, uid, event_id, vals=None, context=context): ->>>>>>> MERGE-SOURCE event_id = base_calendar_id2real_id(event_id) if isinstance(event_id, (int, long)): From 480e6ce964dbe25274f274719f8d14c2e8fe7690 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 13:58:12 +0100 Subject: [PATCH 14/17] [fix] for web client bzr revid: tfr@openerp.com-20110120125812-xixz0c4q8lj9177m --- addons/base_calendar/base_calendar.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index c7381b196a3..1dac8def7af 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1450,6 +1450,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 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'), @@ -1457,7 +1458,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'rrule': '', 'edit_all': False, }) - data.update(vals) + new_id = self.copy(cr, uid, real_event_id, default=data, context=context) date_new = event_id.split('-')[1] From 8f23eb56f4433fcb829f4169b47e245fba3f4d53 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 16:14:57 +0100 Subject: [PATCH 15/17] [FIX] remove result if there is not bzr revid: tfr@openerp.com-20110120151457-mkw07qq7ckx7qfqw --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 1dac8def7af..297003ea4fb 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1545,7 +1545,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ #REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) if not res : - res = {} + continue 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: res['date'] = ls[1] From 413755d92dfd3ddcc808597b45f0aea908145393 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 17:18:42 +0100 Subject: [PATCH 16/17] [FIX] calendar_view for web client bzr revid: tfr@openerp.com-20110120161842-r54saad3yzekxkng --- addons/base_calendar/base_calendar.py | 1 + addons/crm/crm_meeting_view.xml | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 297003ea4fb..2c503c15b94 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1457,6 +1457,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'rrule_type': 'none', 'rrule': '', 'edit_all': False, + 'recurrency' : False, }) new_id = self.copy(cr, uid, real_event_id, default=data, context=context) diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 3ae0a49e72d..2524277b3a2 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -205,14 +205,13 @@ + 'invisible' : [('select1','=','day')]}" /> - + + attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible' : [('select1','=','date')]}" /> + attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible' : [('select1','=','date')]}" /> From 124aa9e86964e686bec3ef82cfd729c1f69a3b9f Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 20 Jan 2011 17:35:58 +0100 Subject: [PATCH 17/17] [FIX] create ir.attachement bzr revid: tfr@openerp.com-20110120163558-nzbyc33vf7mpfuq7 --- addons/base_calendar/base_calendar.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 2c503c15b94..2910f81e590 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1740,6 +1740,14 @@ class ir_attachment(osv.osv): for arg in args: args1.append(map(lambda x:str(x).split('-')[0], arg)) return super(ir_attachment, self).search_count(cr, user, args1, context) + + + + def create(self, cr, uid, vals, context=None): + if context: + id = context.get('default_res_id', False) + context.update({'default_res_id' : base_calendar_id2real_id(id)}) + return super(ir_attachment, self).create(cr, uid, vals, context=context) def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): @@ -1757,9 +1765,9 @@ class ir_attachment(osv.osv): for i, arg in enumerate(new_args): if arg[0] == 'res_id': new_args[i] = (arg[0], arg[1], base_calendar_id2real_id(arg[2])) + return super(ir_attachment, self).search(cr, uid, new_args, offset=offset, - limit=limit, order=order, - context=context, count=False) + limit=limit, order=order, context=context, count=False) ir_attachment() class ir_values(osv.osv):