From 62c133cac537db8cbeafcafb1352d3419e6082c4 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Tue, 21 Jun 2011 12:38:41 +0530 Subject: [PATCH 01/13] [BUG/FIx] project, project_mailgate, fixed the worng method params, imporved the code usabality lp bug: https://launchpad.net/bugs/707984 fixed bzr revid: jam@tinyerp.com-20110621070841-r416gq4xhklffayb --- addons/project/project.py | 18 +++- addons/project_mailgate/project_mailgate.py | 104 +++++++++++--------- 2 files changed, 72 insertions(+), 50 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 072f7cc31c3..ad4f1adb197 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -586,6 +586,8 @@ class task(osv.osv): """ Close Task """ + if context == None: + context = {} request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): vals = {} @@ -640,7 +642,9 @@ class task(osv.osv): return True - def do_cancel(self, cr, uid, ids, *args): + def do_cancel(self, cr, uid, ids, context=None): + if context == None: + context = {} request = self.pool.get('res.request') tasks = self.browse(cr, uid, ids) for task in tasks: @@ -660,7 +664,9 @@ class task(osv.osv): self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}) return True - def do_open(self, cr, uid, ids, *args): + def do_open(self, cr, uid, ids, context=None): + if context == None: + context = {} tasks= self.browse(cr,uid,ids) for t in tasks: data = {'state': 'open'} @@ -671,7 +677,9 @@ class task(osv.osv): self.log(cr, uid, t.id, message) return True - def do_draft(self, cr, uid, ids, *args): + def do_draft(self, cr, uid, ids, context=None): + if context == None: + context = {} self.write(cr, uid, ids, {'state': 'draft'}) return True @@ -707,7 +715,9 @@ class task(osv.osv): self.log(cr, uid, task.id, message) return True - def do_pending(self, cr, uid, ids, *args): + def do_pending(self, cr, uid, ids, context=None): + if context == None: + context = {} self.write(cr, uid, ids, {'state': 'pending'}) for (id, name) in self.name_get(cr, uid, ids): message = _("The task '%s' is pending.") % name diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py index 64bb8c2dc69..3425f9a9a88 100644 --- a/addons/project_mailgate/project_mailgate.py +++ b/addons/project_mailgate/project_mailgate.py @@ -19,17 +19,19 @@ # ############################################################################## -from osv import fields,osv +from osv import fields, osv from tools.translate import _ import binascii + class project_tasks(osv.osv): _name = "project.task" - _inherit = ['mailgate.thread','project.task'] - + _inherit = ['mailgate.thread', 'project.task'] + _columns={ - 'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True), + 'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model', '=', _name)], readonly=True), } + def message_new(self, cr, uid, msg, context=None): # """ # Automatically calls when new email message arrives @@ -44,21 +46,21 @@ class project_tasks(osv.osv): msg_from = msg.get('from') priority = msg.get('priority') - data = { + data = { 'name': subject, 'description': body, - 'planned_hours' : 0.0, + 'planned_hours': 0.0, } res = mailgate_obj.get_partner(cr, uid, msg_from) if res: data.update(res) - res = self.create(cr, uid, data) - + res = self.create(cr, uid, data) + attachments = msg.get('attachments', []) for attachment in attachments or []: data_attach = { 'name': attachment, - 'datas':binascii.b2a_base64(str(attachments.get(attachment))), + 'datas': binascii.b2a_base64(str(attachments.get(attachment))), 'datas_fname': attachment, 'description': 'Mail attachment', 'res_model': self._name, @@ -66,31 +68,31 @@ class project_tasks(osv.osv): } self.pool.get('ir.attachment').create(cr, uid, data_attach) - return res - - def message_update(self, cr, uid, id, msg, data={}, default_act='pending'): + return res + + def message_update(self, cr, uid, id, msg, data={}, default_act='pending'): mailgate_obj = self.pool.get('email.server.tools') - msg_actions, body_data = mailgate_obj.msg_act_get(msg) + msg_actions, body_data = mailgate_obj.msg_act_get(msg) data.update({ - 'description': body_data, + 'description': body_data, }) act = 'do_'+default_act if 'state' in msg_actions: - if msg_actions['state'] in ['draft','close','cancel','open','pending']: + if msg_actions['state'] in ['draft', 'close', 'cancel', 'open', 'pending']: act = 'do_' + msg_actions['state'] - - for k1,k2 in [('cost','planned_hours')]: + + for k1, k2 in [('cost', 'planned_hours')]: try: data[k2] = float(msg_actions[k1]) except: pass if 'priority' in msg_actions: - if msg_actions['priority'] in ('1','2','3','4','5'): + if msg_actions['priority'] in ('1', '2', '3', '4', '5'): data['priority'] = msg_actions['priority'] - + self.write(cr, uid, [id], data) - getattr(self,act)(cr, uid, [id]) + getattr(self, act)(cr, uid, [id]) return True def message_followers(self, cr, uid, ids, context=None): @@ -108,7 +110,7 @@ class project_tasks(osv.osv): def msg_send(self, cr, uid, id, *args, **argv): return True - + def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context=None): mailgate_pool = self.pool.get('mailgate.thread') return mailgate_pool.history(cr, uid, cases, keyword, history=history,\ @@ -116,37 +118,47 @@ class project_tasks(osv.osv): details=details, email_from=email_from,\ message_id=message_id, attach=attach, \ context=context) - - def do_draft(self, cr, uid, ids, *args, **kwargs): - res = super(project_tasks, self).do_draft(cr, uid, ids, *args, **kwargs) - tasks = self.browse(cr, uid, ids) - self._history(cr, uid, tasks, _('Draft')) + + def do_draft(self, cr, uid, ids, context): + if context == None: + context = {} + res = super(project_tasks, self).do_draft(cr, uid, ids, context) + tasks = self.browse(cr, uid, ids, context=context) + self._history(cr, uid, tasks, _('Draft'), context=context) return res - - def do_open(self, cr, uid, ids, *args, **kwargs): - res = super(project_tasks, self).do_open(cr, uid, ids, *args, **kwargs) - tasks = self.browse(cr, uid, ids) - self._history(cr, uid, tasks, _('Open')) + + def do_open(self, cr, uid, ids, context=None): + if context == None: + context = {} + res = super(project_tasks, self).do_open(cr, uid, ids, context) + tasks = self.browse(cr, uid, ids, context=context) + self._history(cr, uid, tasks, _('Open'), context=context) return res - - def do_pending(self, cr, uid, ids, *args, **kwargs): - res = super(project_tasks, self).do_pending(cr, uid, ids, *args, **kwargs) - tasks = self.browse(cr, uid, ids) - self._history(cr, uid, tasks, _('Pending')) + + def do_pending(self, cr, uid, ids, context=None): + if context == None: + context = {} + res = super(project_tasks, self).do_pending(cr, uid, ids, context) + tasks = self.browse(cr, uid, ids, context=context) + self._history(cr, uid, tasks, _('Pending'), context=context) return res - - def do_close(self, cr, uid, ids, *args, **kwargs): - res = super(project_tasks, self).do_close(cr, uid, ids, *args, **kwargs) - tasks = self.browse(cr, uid, ids) + + def do_close(self, cr, uid, ids, context=None): + if context == None: + context = {} + res = super(project_tasks, self).do_close(cr, uid, ids, context) + tasks = self.browse(cr, uid, ids, context=context) for task in tasks: if task.state == 'done': - self._history(cr, uid, tasks, _('Done')) + self._history(cr, uid, tasks, _('Done'), context=context) return res - - def do_cancel(self, cr, uid, ids, *args, **kwargs): - res = super(project_tasks, self).do_cancel(cr, uid, ids, *args, **kwargs) - tasks = self.browse(cr, uid, ids) - self._history(cr, uid, tasks, _('Cancel')) + + def do_cancel(self, cr, uid, ids, context=None): + if context == None: + context = {} + res = super(project_tasks, self).do_cancel(cr, uid, ids, context=context) + tasks = self.browse(cr, uid, ids, context=context) + self._history(cr, uid, tasks, _('Cancel'), context=context) return res project_tasks() From 57cda8ce287aa76bc2837300c19b5ac8fd572b33 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Tue, 21 Jun 2011 18:37:35 +0530 Subject: [PATCH 02/13] [FIX] project : passing context on osv calls bzr revid: jam@tinyerp.com-20110621130735-1e4vy9vtlsy40r6k --- addons/project/project.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index ad4f1adb197..f1fee929ac2 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -603,7 +603,7 @@ class task(osv.osv): 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d'% (task.id,), 'ref_doc2': 'project.project,%d'% (project.id,), - }) + }, context=context) for parent_id in task.parent_ids: if parent_id.state in ('pending','draft'): @@ -612,12 +612,12 @@ class task(osv.osv): if child.id != task.id and child.state not in ('done','cancelled'): reopen = False if reopen: - self.do_reopen(cr, uid, [parent_id.id]) + self.do_reopen(cr, uid, [parent_id.id], context=context) 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) + self.write(cr, uid, [task.id],vals, context=context) message = _("The task '%s' is done") % (task.name,) self.log(cr, uid, task.id, message) return True @@ -636,17 +636,16 @@ class task(osv.osv): 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d' % task.id, 'ref_doc2': 'project.project,%d' % project.id, - }) - - self.write(cr, uid, [task.id], {'state': 'open'}) + }, context=context) + self.write(cr, uid, [task.id], {'state': 'open'}, context=context) return True def do_cancel(self, cr, uid, ids, context=None): if context == None: context = {} request = self.pool.get('res.request') - tasks = self.browse(cr, uid, ids) + tasks = self.browse(cr, uid, ids, context=context) for task in tasks: project = task.project_id if project.warn_manager and project.user_id and (project.user_id.id != uid): @@ -658,21 +657,21 @@ class task(osv.osv): 'ref_partner_id': task.partner_id.id, 'ref_doc1': 'project.task,%d' % task.id, 'ref_doc2': 'project.project,%d' % project.id, - }) + }, context=context) message = _("The task '%s' is cancelled.") % (task.name,) self.log(cr, uid, task.id, message) - self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}) + self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}, context=context) return True def do_open(self, cr, uid, ids, context=None): if context == None: context = {} - tasks= self.browse(cr,uid,ids) + tasks= self.browse(cr, uid, ids, context=context) for t in tasks: data = {'state': 'open'} if not t.date_start: data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S') - self.write(cr, uid, [t.id], data) + self.write(cr, uid, [t.id], data, context=context) message = _("The task '%s' is opened.") % (t.name,) self.log(cr, uid, t.id, message) return True @@ -680,7 +679,7 @@ class task(osv.osv): def do_draft(self, cr, uid, ids, context=None): if context == None: context = {} - self.write(cr, uid, ids, {'state': 'draft'}) + self.write(cr, uid, ids, {'state': 'draft'}, context=context) return True def do_delegate(self, cr, uid, task_id, delegate_data={}, context=None): @@ -718,7 +717,7 @@ class task(osv.osv): def do_pending(self, cr, uid, ids, context=None): if context == None: context = {} - self.write(cr, uid, ids, {'state': 'pending'}) + self.write(cr, uid, ids, {'state': 'pending'}, context=context) for (id, name) in self.name_get(cr, uid, ids): message = _("The task '%s' is pending.") % name self.log(cr, uid, id, message) From b0e033f261d65ab163666ce8a62ea5873b9e7b14 Mon Sep 17 00:00:00 2001 From: "Ashutosh Srivastava (Open ERP)" Date: Tue, 28 Jun 2011 15:55:36 +0530 Subject: [PATCH 03/13] [FIX] crm : Inconsistency when scheduling a call from an opportunity lp bug: https://launchpad.net/bugs/689566 fixed bzr revid: asr@tinyerp.com-20110628102536-cgjyefsqyme82qfk --- addons/crm/crm_phonecall.py | 2 +- addons/crm/wizard/crm_opportunity_to_phonecall.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index c643d9db8af..1f4d7688fef 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -91,7 +91,7 @@ class crm_phonecall(crm_base, osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': crm.AVAILABLE_PRIORITIES[2][0], 'state': _get_default_state, - 'user_id': lambda self,cr,uid,ctx: uid, + #'user_id': lambda self,cr,uid,ctx: uid, 'active': 1, } diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py index af95dd5554b..4bd73cae8e9 100644 --- a/addons/crm/wizard/crm_opportunity_to_phonecall.py +++ b/addons/crm/wizard/crm_opportunity_to_phonecall.py @@ -126,7 +126,7 @@ class crm_opportunity2phonecall(osv.osv_memory): 'categ_id' : this.categ_id.id, 'description' : opp.description or False, 'date' : this.date, - 'section_id' : this.section_id.id or opp.section_id.id or False, + 'section_id' : this.section_id.id or False, 'partner_id': opp.partner_id and opp.partner_id.id or False, 'partner_address_id': opp.partner_address_id and opp.partner_address_id.id or False, 'partner_phone' : opp.phone or (opp.partner_address_id and opp.partner_address_id.phone or False), @@ -134,7 +134,9 @@ class crm_opportunity2phonecall(osv.osv_memory): 'priority': opp.priority, 'opportunity_id': opp.id } + new_case = phonecall_obj.create(cr, uid, vals, context=context) + if this.action == 'schedule': phonecall_obj.case_open(cr, uid, [new_case]) elif this.action == 'log': @@ -142,14 +144,15 @@ class crm_opportunity2phonecall(osv.osv_memory): value = { 'name': _('Phone Call'), - 'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id), + #'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id), 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'crm.phonecall', 'res_id' : new_case, 'views': [(id3, 'form'), (id2, 'tree'), (False, 'calendar')], 'type': 'ir.actions.act_window', - 'search_view_id': res['res_id'] + 'search_view_id': res['res_id'], + 'context':context, } return value From b84340d46efda0799014595679b3d5e03676edc2 Mon Sep 17 00:00:00 2001 From: "Ashutosh Srivastava (Open ERP)" Date: Tue, 28 Jun 2011 16:16:35 +0530 Subject: [PATCH 04/13] crm :remove comment bzr revid: asr@tinyerp.com-20110628104635-e7w3eupitogc8p04 --- addons/crm/crm_phonecall.py | 2 +- addons/crm/wizard/crm_opportunity_to_phonecall.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index 1f4d7688fef..c643d9db8af 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -91,7 +91,7 @@ class crm_phonecall(crm_base, osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': crm.AVAILABLE_PRIORITIES[2][0], 'state': _get_default_state, - #'user_id': lambda self,cr,uid,ctx: uid, + 'user_id': lambda self,cr,uid,ctx: uid, 'active': 1, } diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall.py b/addons/crm/wizard/crm_opportunity_to_phonecall.py index 4bd73cae8e9..381eb6f512c 100644 --- a/addons/crm/wizard/crm_opportunity_to_phonecall.py +++ b/addons/crm/wizard/crm_opportunity_to_phonecall.py @@ -144,7 +144,7 @@ class crm_opportunity2phonecall(osv.osv_memory): value = { 'name': _('Phone Call'), - #'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id), + 'domain': "[('user_id','=',%s),('opportunity_id','=',%s)]" % (uid,opp.id), 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'crm.phonecall', @@ -152,7 +152,6 @@ class crm_opportunity2phonecall(osv.osv_memory): 'views': [(id3, 'form'), (id2, 'tree'), (False, 'calendar')], 'type': 'ir.actions.act_window', 'search_view_id': res['res_id'], - 'context':context, } return value From 53d27331d74161cb169e5869c1fdb6a5b6ac9a54 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Tue, 28 Jun 2011 16:24:05 +0530 Subject: [PATCH 05/13] [FIX] project :code refectoring - context checking bzr revid: jam@tinyerp.com-20110628105405-te8gigvwh860c41u --- addons/project/project.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index f1fee929ac2..c2d029d7284 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -582,12 +582,10 @@ class task(osv.osv): } return res - def do_close(self, cr, uid, ids, context=None): + def do_close(self, cr, uid, ids, context={}): """ Close Task """ - if context == None: - context = {} request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): vals = {} @@ -641,9 +639,7 @@ class task(osv.osv): self.write(cr, uid, [task.id], {'state': 'open'}, context=context) return True - def do_cancel(self, cr, uid, ids, context=None): - if context == None: - context = {} + def do_cancel(self, cr, uid, ids, context={}): request = self.pool.get('res.request') tasks = self.browse(cr, uid, ids, context=context) for task in tasks: @@ -663,9 +659,7 @@ class task(osv.osv): self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}, context=context) return True - def do_open(self, cr, uid, ids, context=None): - if context == None: - context = {} + def do_open(self, cr, uid, ids, context={}): tasks= self.browse(cr, uid, ids, context=context) for t in tasks: data = {'state': 'open'} @@ -676,9 +670,7 @@ class task(osv.osv): self.log(cr, uid, t.id, message) return True - def do_draft(self, cr, uid, ids, context=None): - if context == None: - context = {} + def do_draft(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'draft'}, context=context) return True @@ -714,9 +706,7 @@ class task(osv.osv): self.log(cr, uid, task.id, message) return True - def do_pending(self, cr, uid, ids, context=None): - if context == None: - context = {} + def do_pending(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'pending'}, context=context) for (id, name) in self.name_get(cr, uid, ids): message = _("The task '%s' is pending.") % name From 46a7bb30c72028079dbce17643c10f2d9b68d117 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Wed, 29 Jun 2011 12:48:13 +0530 Subject: [PATCH 06/13] [BUG/FIX] base_calendar - day need to store to db values is being updated bzr revid: jam@tinyerp.com-20110629071813-dwvkaiizvkqdojbi --- 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 341354ff126..4df126e191e 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1023,7 +1023,7 @@ defines the list of date/time exceptions for a recurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="Defines a \ rule or repeating pattern of time to exclude from the recurring rule."), 'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \ - string='Recurrent Rule'), + store=True, string='Recurrent Rule'), 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ ('yearly', 'Yearly'),], From 09f6d30a1a9ed0d84ce2c28bdb34a0a7a9a4412f Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Wed, 29 Jun 2011 12:58:12 +0530 Subject: [PATCH 07/13] [FIX] removed unsed cnotext checking bzr revid: jam@tinyerp.com-20110629072812-ht43md6u43a7lb8f --- addons/project_mailgate/project_mailgate.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py index 3425f9a9a88..1261a25f4f2 100644 --- a/addons/project_mailgate/project_mailgate.py +++ b/addons/project_mailgate/project_mailgate.py @@ -120,32 +120,24 @@ class project_tasks(osv.osv): context=context) def do_draft(self, cr, uid, ids, context): - if context == None: - context = {} res = super(project_tasks, self).do_draft(cr, uid, ids, context) tasks = self.browse(cr, uid, ids, context=context) self._history(cr, uid, tasks, _('Draft'), context=context) return res def do_open(self, cr, uid, ids, context=None): - if context == None: - context = {} res = super(project_tasks, self).do_open(cr, uid, ids, context) tasks = self.browse(cr, uid, ids, context=context) self._history(cr, uid, tasks, _('Open'), context=context) return res def do_pending(self, cr, uid, ids, context=None): - if context == None: - context = {} res = super(project_tasks, self).do_pending(cr, uid, ids, context) tasks = self.browse(cr, uid, ids, context=context) self._history(cr, uid, tasks, _('Pending'), context=context) return res def do_close(self, cr, uid, ids, context=None): - if context == None: - context = {} res = super(project_tasks, self).do_close(cr, uid, ids, context) tasks = self.browse(cr, uid, ids, context=context) for task in tasks: @@ -154,8 +146,6 @@ class project_tasks(osv.osv): return res def do_cancel(self, cr, uid, ids, context=None): - if context == None: - context = {} res = super(project_tasks, self).do_cancel(cr, uid, ids, context=context) tasks = self.browse(cr, uid, ids, context=context) self._history(cr, uid, tasks, _('Cancel'), context=context) From 5b193753017d5ddc07baab5fc227f4fd2d99e38d Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Wed, 29 Jun 2011 14:02:22 +0530 Subject: [PATCH 08/13] [FIX] missing context param bzr revid: jam@tinyerp.com-20110629083222-47rl2yy2vj3tdxfd --- addons/project_mailgate/project_mailgate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py index 1261a25f4f2..779a0c266e2 100644 --- a/addons/project_mailgate/project_mailgate.py +++ b/addons/project_mailgate/project_mailgate.py @@ -119,7 +119,7 @@ class project_tasks(osv.osv): message_id=message_id, attach=attach, \ context=context) - def do_draft(self, cr, uid, ids, context): + def do_draft(self, cr, uid, ids, context=None): res = super(project_tasks, self).do_draft(cr, uid, ids, context) tasks = self.browse(cr, uid, ids, context=context) self._history(cr, uid, tasks, _('Draft'), context=context) From e50fa20f19ed0baddb733ab433702554cd98728b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 29 Jun 2011 11:51:38 +0200 Subject: [PATCH 09/13] [FIX] netsvc: corrected copyright header Corrected license to AGPLv3, and removed obsolete copyright lines as confirmed by Cedric Krier by email on 2011-06-29. These copyright lines referred to a refactoring copied from Tryton in revision rev 1439 - stephane@tinyerp.com-20081218235433-cnsc5a4iyfzqvbdx All this code has disappeared since then, specifically after a major rewrite by xrg, merged at revision 1900 (mga@tinyerp.com-20091126113653-0ym60nvtjinvp82h). bzr revid: odo@openerp.com-20110629095138-hmo91mvk1m8u4643 --- openerp/netsvc.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/openerp/netsvc.py b/openerp/netsvc.py index 5fc12ba8b35..323062312b1 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -3,23 +3,19 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# The refactoring about the OpenSSL support come from Tryton -# Copyright (C) 2007-2009 Cédric Krier. -# Copyright (C) 2007-2009 Bertrand Chenal. -# Copyright (C) 2008 B2CK SPRL. +# Copyright (C) 2004-2011 OpenERP SA () # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################## From c5d10cfe8d822f797910b8390ba1f7260e9bc953 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Wed, 29 Jun 2011 13:15:00 +0200 Subject: [PATCH 10/13] [clean] remove print statement bzr revid: tfr@openerp.com-20110629111500-v1u6uncjsblx7rkd --- addons/crm/crm_phonecall.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index dce8a931aee..ecae065beac 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -86,16 +86,12 @@ class crm_phonecall(crm_base, osv.osv): if context and context.get('default_state', False): return context.get('default_state') return 'open' - - def get_user_id(self, cr, uid, ctx): - print "default user" - return uid _defaults = { 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'priority': crm.AVAILABLE_PRIORITIES[2][0], 'state': _get_default_state, - 'user_id': get_user_id, + 'user_id': lambda self,cr,uid,ctx: uid, 'active': 1, } From e6483eb6ba0fe708362c70364626b437bffd1980 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 29 Jun 2011 15:12:33 +0200 Subject: [PATCH 11/13] [FIX] typos in python code bzr revid: xmo@openerp.com-20110629131233-tvxwkrke73ytrw2a --- addons/base/controllers/main.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index 9869adad92a..7098f7f8f90 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -237,7 +237,7 @@ def eval_context_and_domain(session, context, domain=None): # should we give the evaluated context as an evaluation context to the domain? e_domain = session.eval_domain(domain or []) - return (e_context, e_domain) + return e_context, e_domain def load_actions_from_ir_values(req, key, key2, models, meta, context): Values = req.session.model('ir.values') @@ -438,21 +438,20 @@ class DataSet(openerpweb.Controller): return {'result': r} @openerpweb.jsonrequest - def unlink(self, request, model, ids=[]): + def unlink(self, request, model, ids=()): Model = request.session.model(model) return Model.unlink(ids, request.session.eval_context(request.context)) def call_common(self, req, model, method, args, domain_id=None, context_id=None): domain = args[domain_id] if domain_id and len(args) - 1 >= domain_id else [] context = args[context_id] if context_id and len(args) - 1 >= context_id else {} - c, d = eval_context_and_domain(req.session, context, domain); - if(domain_id and len(args) - 1 >= domain_id): + c, d = eval_context_and_domain(req.session, context, domain) + if domain_id and len(args) - 1 >= domain_id: args[domain_id] = d - if(context_id and len(args) - 1 >= context_id): + if context_id and len(args) - 1 >= context_id: args[context_id] = c - m = req.session.model(model) - return getattr(m, method)(*args) + return getattr(req.session.model(model), method)(*args) @openerpweb.jsonrequest def call(self, req, model, method, args, domain_id=None, context_id=None): @@ -713,7 +712,7 @@ class Binary(openerpweb.Controller): for key, val in cherrypy.request.headers.iteritems(): headers[key.lower()] = val size = int(headers.get('content-length', 0)) - # TODO: might be usefull to have a configuration flag for max-lenght file uploads + # TODO: might be useful to have a configuration flag for max-length file uploads try: out = """