diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 98aea630ef1..850691d329c 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -30,6 +30,7 @@ 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", \ @@ -1080,8 +1081,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,)) @@ -1256,7 +1255,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ ids = select result = [] recur_dict = [] - if ids and (base_start_date or base_until_date): + if ids: cr.execute("select m.id, m.rrule, m.date, m.date_deadline, m.duration, \ m.exdate, m.exrule, m.recurrent_id, m.recurrent_uid from " + self._table + \ " m where m.id = ANY(%s)", (ids,) ) @@ -1425,19 +1424,25 @@ 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) - if len(str(event_id).split('-')) > 1: + 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: data = self.read(cr, uid, event_id, ['date', 'date_deadline', \ 'rrule', 'duration']) if data.get('rrule'): 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: @@ -1454,6 +1459,7 @@ 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) @@ -1515,6 +1521,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] @@ -1553,8 +1561,9 @@ 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'], context=context): + for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate', 'edit_all'], 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) @@ -1562,12 +1571,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ else: str_event, date_new = event_id.split('-') event_id = int(str_event) - if event_datas['rrule']: + if event_datas['rrule'] and not edit_all: # 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 = self.write(cr, uid, [event_id], {'exdate': exdate}) + res = super(calendar_event, 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) @@ -1601,7 +1610,8 @@ 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) - return res + records = self.browse(cr, uid, [res], context=context) + return real_id2base_calendar_id(records[0].id, records[0].date) def do_tentative(self, cr, uid, ids, context=None, *args): """ Makes event invitation as Tentative diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index d536ef02824..a7258feea0f 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -240,7 +240,7 @@ - + @@ -344,7 +344,7 @@ - + - + @@ -165,11 +165,10 @@ - + - + diff --git a/addons/crm_claim/report/crm_claim_report_view.xml b/addons/crm_claim/report/crm_claim_report_view.xml index 94561e87bfa..e790183e5db 100644 --- a/addons/crm_claim/report/crm_claim_report_view.xml +++ b/addons/crm_claim/report/crm_claim_report_view.xml @@ -20,7 +20,6 @@ - diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 9d6328af1eb..3e7a4a1b3a2 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -126,7 +126,7 @@ class hr_holidays(osv.osv): 'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)]}), 'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}), 'number_of_days': fields.function(_compute_number_of_days, method=True, string='Number of Days', store=True), - 'case_id': fields.many2one('crm.meeting', 'Meeting'), + 'case_id': fields.char('Meeting', size=64), 'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone"), 'parent_id': fields.many2one('hr.holidays', 'Parent'), 'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',), @@ -290,7 +290,7 @@ class hr_holidays(osv.osv): for record in self.browse(cr, uid, ids): # Delete the meeting if record.case_id: - obj_crm_meeting.unlink(cr, uid, [record.case_id.id]) + obj_crm_meeting.unlink(cr, uid, [record.case_id]) # If a category that created several holidays, cancel all related wf_service = netsvc.LocalService("workflow") diff --git a/addons/project/project.py b/addons/project/project.py index 663ef5673de..bff63746d9a 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -476,8 +476,20 @@ class task(osv.osv): ids = child_ids return True + def _check_dates(self, cr, uid, ids, context=None): + if context == None: + context = {} + obj_task = self.browse(cr, uid, ids[0], context=context) + start = obj_task.date_start or False + end = obj_task.date_end or False + if start and end : + if start > end: + return False + return True + _constraints = [ - (_check_recursion, 'Error ! You cannot create recursive tasks.', ['parent_ids']) + (_check_recursion, 'Error ! You cannot create recursive tasks.', ['parent_ids']), + (_check_dates, 'Error ! Task end-date must be greater then task start-date', ['date_start','date_end']) ] # # Override view according to the company definition @@ -541,6 +553,7 @@ class task(osv.osv): """ request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): + vals = {} project = task.project_id if project: # Send request to project manager @@ -563,7 +576,11 @@ class task(osv.osv): reopen = False if reopen: self.do_reopen(cr, uid, [parent_id.id]) - self.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0}) + vals.update({'state': 'done'}) + vals.update({'remaining_hours': 0.0}) + if not task.date_end: + vals.update({ 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}) + self.write(cr, uid, [task.id],vals) message = _("The task '%s' is done") % (task.name,) self.log(cr, uid, task.id, message) return True diff --git a/addons/survey/survey.py b/addons/survey/survey.py index c06d274f20d..a36f8a1ffa6 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -184,7 +184,7 @@ class survey_page(osv.osv): if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'): data['sequence'] = context['line_order'][-1][2]['sequence'] + 1 if context.has_key('survey_id'): - data['survey_id'] = context['survey_id'] + data['survey_id'] = context.get('survey_id', False) return data def survey_save(self, cr, uid, ids, context=None): diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 23315d51c65..0d541079ba6 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -297,8 +297,9 @@ class survey_question_wiz(osv.osv_memory): fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id)] = {'type':'datetime', 'string':ans.answer} elif que_rec.type == 'descriptive_text': - for que_test in que_rec.descriptive_text.split('\n'): - etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) + if que_rec.descriptive_text: + for que_test in que_rec.descriptive_text.split('\n'): + etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) elif que_rec.type == 'single_textbox': etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_single", 'nolabel':"1" ,'colspan':"4"}) diff --git a/addons/thunderbird/plugin/openerp_plugin.xpi b/addons/thunderbird/plugin/openerp_plugin.xpi index 50a55a626e4..d48a2a5c45e 100644 Binary files a/addons/thunderbird/plugin/openerp_plugin.xpi and b/addons/thunderbird/plugin/openerp_plugin.xpi differ diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar index c52c70bf74e..cf2c5037405 100644 Binary files a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar and b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar differ diff --git a/addons/thunderbird/plugin/openerp_plugin/makefile b/addons/thunderbird/plugin/openerp_plugin/makefile index 711fdfe117e..17ed0319bcc 100644 --- a/addons/thunderbird/plugin/openerp_plugin/makefile +++ b/addons/thunderbird/plugin/openerp_plugin/makefile @@ -1,7 +1,7 @@ all: xpi jar: - jar cvf chrome/openerp_plugin.jar chrome/openerp_plugin/* + jar cvf chrome/openerp_plugin.jar -C chrome/openerp_plugin/ . xpi: jar zip -r ../openerp_plugin.xpi *