From 4b2f93cb343874fb828a62694a09a858f7cc45c0 Mon Sep 17 00:00:00 2001 From: "Rifakat Haradwala (Open ERP)" Date: Thu, 21 Apr 2011 14:49:15 +0530 Subject: [PATCH] [FIX]: removed method _history() and called history() instead bzr revid: rha@tinyerp.com-20110421091915-fw1sr549av69mm4b --- addons/crm/crm.py | 21 ++++++-------------- addons/crm/crm_action_rule.py | 2 +- addons/crm/wizard/crm_merge_opportunities.py | 2 +- addons/project_issue/project_issue.py | 2 +- addons/project_mailgate/project_mailgate.py | 18 +++++------------ addons/sale_crm/wizard/crm_make_sale.py | 2 +- 6 files changed, 15 insertions(+), 32 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 0c84820b5fa..4459f7ca217 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -307,14 +307,6 @@ class crm_case(object): else: return {'value': {'phone': address.phone}} - def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context=None): - thread_pool = self.pool.get('email.thread') - return thread_pool.history(cr, uid, cases, keyword, history=history,\ - subject=subject, email=email, \ - details=details, email_from=email_from,\ - message_id=message_id, attach=attach, \ - context=context) - def case_open(self, cr, uid, ids, *args): """Opens Case @param self: The object pointer @@ -325,7 +317,7 @@ class crm_case(object): """ cases = self.browse(cr, uid, ids) - self._history(cr, uid, cases, _('Open')) + self.history(cr, uid, cases, _('Open')) for case in cases: data = {'state': 'open', 'active': True} if not case.user_id: @@ -346,7 +338,7 @@ class crm_case(object): """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache - self._history(cr, uid, cases, _('Close')) + self.history(cr, uid, cases, _('Close')) self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), }) @@ -377,7 +369,7 @@ class crm_case(object): raise osv.except_osv(_('Error !'), _('You can not escalate, You are already at the top level regarding your sales-team category.')) self.write(cr, uid, [case.id], data) cases = self.browse(cr, uid, ids) - self._history(cr, uid, cases, _('Escalate')) + self.history(cr, uid, cases, _('Escalate')) self._action(cr, uid, cases, 'escalate') return True @@ -391,7 +383,7 @@ class crm_case(object): """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache - self._history(cr, uid, cases, _('Cancel')) + self.history(cr, uid, cases, _('Cancel')) self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) self._action(cr, uid, cases, 'cancel') @@ -410,7 +402,7 @@ class crm_case(object): """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache - self._history(cr, uid, cases, _('Pending')) + self.history(cr, uid, cases, _('Pending')) self.write(cr, uid, ids, {'state': 'pending', 'active': True}) self._action(cr, uid, cases, 'pending') return True @@ -425,7 +417,7 @@ class crm_case(object): """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache - self._history(cr, uid, cases, _('Draft')) + self.history(cr, uid, cases, _('Draft')) self.write(cr, uid, ids, {'state': 'draft', 'active': True}) self._action(cr, uid, cases, 'draft') return True @@ -498,7 +490,6 @@ class crm_case(object): openobject_id=str(case.id), attach=attach_to_send ) - self._history(cr, uid, [case], _('Send'), history=True, subject=subject, email=dest, details=body, email_from=src) return True def _check(self, cr, uid, ids=False, context=None): diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index acb7801c7c9..f510ac73c4b 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -125,7 +125,7 @@ this if you want the rule to send an email to the partner."), # Put state change by rule in communication history if hasattr(obj, 'state') and action.act_state: - model_obj._history(cr, uid, [obj], _(action.act_state)) + model_obj.history(cr, uid, [obj], _(action.act_state)) model_obj.write(cr, uid, [obj.id], write, context) emails = [] diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py index 82e3f6402fc..bdf179a48aa 100644 --- a/addons/crm/wizard/crm_merge_opportunities.py +++ b/addons/crm/wizard/crm_merge_opportunities.py @@ -148,7 +148,7 @@ class crm_merge_opportunity(osv.osv_memory): subject = subject[0] + ", ".join(subject[1:]) details = "\n\n".join(details) - opp_obj._history(cr, uid, [first_opportunity], subject, details=details) + opp_obj.history(cr, uid, [first_opportunity], subject, details=details) #data.update({'message_ids' : [(6, 0 ,self._concat_o2m('message_ids', op_ids))]}) opp_obj.write(cr, uid, [first_opportunity.id], data) unlink_ids = map(lambda x: x.id, tail_opportunities) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index e9e5521d94b..a88ee17496e 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -361,7 +361,7 @@ class project_issue(crm.crm_case, osv.osv): else: raise osv.except_osv(_('Warning !'), _('You cannot escalate this issue.\nThe relevant Project has not configured the Escalation Project!')) self.write(cr, uid, [case.id], data) - self._history(cr, uid, cases, _('Escalate')) + self.history(cr, uid, cases, _('Escalate')) return True def message_new(self, cr, uid, msg, context=None): diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py index dc0f04aeddf..cea05b3fa44 100644 --- a/addons/project_mailgate/project_mailgate.py +++ b/addons/project_mailgate/project_mailgate.py @@ -120,30 +120,22 @@ class project_tasks(osv.osv): return len(res) and res[0] or False return res - def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context=None): - thread_pool = self.pool.get('email.thread') - return thread_pool.history(cr, uid, cases, keyword, history=history,\ - subject=subject, email=email, \ - 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')) + self.history(cr, uid, tasks, _('Draft')) 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')) + self.history(cr, uid, tasks, _('Open')) 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')) + self.history(cr, uid, tasks, _('Pending')) return res def do_close(self, cr, uid, ids, *args, **kwargs): @@ -151,13 +143,13 @@ class project_tasks(osv.osv): tasks = self.browse(cr, uid, ids) for task in tasks: if task.state == 'done': - self._history(cr, uid, tasks, _('Done')) + self.history(cr, uid, tasks, _('Done')) 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')) + self.history(cr, uid, tasks, _('Cancel')) return res project_tasks() diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index f48df128e31..2c7f6cb0d69 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -107,7 +107,7 @@ class crm_make_sale(osv.osv_memory): new_ids.append(new_id) message = _("Opportunity '%s' is converted to Quotation.") % (case.name) self.log(cr, uid, case.id, message) - case_obj._history(cr, uid, [case], _("Converted to Sales Quotation(id: %s).") % (new_id)) + case_obj.history(cr, uid, [case], _("Converted to Sales Quotation(id: %s).") % (new_id)) if make.close: case_obj.case_close(cr, uid, data)