← Back to team overview

openerp-india team mailing list archive

[Bug 931079] Re: [CRM] automated action are executed twice

 

Guys,

Recalling Olivier Dony's fix http://bazaar.launchpad.net/~openerp
/openobject-addons/6.1/revision/6651, this is supposed to be said as
fixed and released!

Thanks,
Serpent Consulting Services.

** Changed in: openobject-addons
       Status: Expired => Fix Released

** Changed in: openobject-addons
   Importance: Undecided => Medium

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP Publisher's Warranty Team (openerp-opw)

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/931079

Title:
  [CRM] automated action are executed twice

Status in OpenERP Addons (modules):
  Fix Released

Bug description:
  Hi I don't know if it's a bug or a volontary behaviour.
  I start to test the CRM module and the mailling system.
  First of all, great works ;) OpenERP SA have done a good job.

  I start my first module in order to support the email template with automated action.
  For that I overwrite the method  "def do_action(self, cr, uid, action, model_obj, obj, context=None):"
  After some test I realise that my mail was send twice. Indeed If you check the module "CRM" line 112. You will see that a call to super is done. But a previous one was done before line 93. It's the first time that I see a double call to super in the same function.
  I don't know if it's a mistake or if it's intentional.

  Can you tell me why there is this code?

  Here is the code
      def do_action(self, cr, uid, action, model_obj, obj, context=None):
          res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)    <<<<first call of super here
          write = {}
          if hasattr(action, 'act_section_id') and action.act_section_id:
              obj.section_id = action.act_section_id
              write['section_id'] = action.act_section_id.id

          if hasattr(obj, 'email_cc') and action.act_email_cc:
              if '@' in (obj.email_cc or ''):
                  emails = obj.email_cc.split(",")
                  if  obj.act_email_cc not in emails:# and '<'+str(action.act_email_cc)+">" not in emails:
                      write['email_cc'] = obj.email_cc + ',' + obj.act_email_cc
              else:
                  write['email_cc'] = obj.act_email_cc

          # Put state change by rule in communication history
          if hasattr(obj, 'state') and hasattr(obj, 'message_append') and action.act_state:
              model_obj.message_append(cr, uid, [obj], _(action.act_state))

          model_obj.write(cr, uid, [obj.id], write, context)
          super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)      <<<<second call of super here
          emails = []

          if hasattr(obj, 'email_from') and action.act_mail_to_partner:
              emails.append(obj.email_from)
          emails = filter(None, emails)
          if len(emails) and action.act_mail_body:
              emails = list(set(emails))
              self.email_send(cr, uid, obj, emails, action.act_mail_body)
          return True

  Have a nice day

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/931079/+subscriptions


References