← Back to team overview

openerp-india team mailing list archive

[Bug 1012684] [NEW] server action not executed on wkf activity with kind=flowstop

 

Public bug reported:

I am trying to send a mail when a holiday request is
confirmed/accepted/refused, using the 'email_template' module. For that,
I developped a small module "hr_holidays_mail", see enclosed.

It works well when the holiday request is confirmed and accepted, but it
doesn't work when the holiday request is refused.

After some investigation, I found out that :

In addons-trunk/hr_holidays/hr_holidays_workflow.xml line 46 :

the workflow activity "refuse" is of kind 'stopall' (is was not the case
in OpenERP 5.0 ; it is the case since OpenERP 6.0)

In server-trunk/openerp/workflow/workitem.py line 122 :

when kind == 'stopall', it doesn't consider the 'action_id' of the workflow activity.
Instead, if you look line 99, when kind == 'dummy' or 'function', you see this code which executes the server action :

if activity['action_id']:
    res2 = wkf_expr.execute_action(cr, ident, workitem, activity)
    if res2:
        stack.append(res2)
        result=res2

So, what is the good solution if I want to send an email when a holiday request is refused ?
1) in addons/hr_holidays, modify the kind of the workflow activity "refuse" from "stopall" to "dummy" ?
2) patch the server to execute the server action on an activity with kind = flowstop ?

All suggestions are welcomed !

** Affects: openobject-server
     Importance: Undecided
         Status: New

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

Title:
  server action not executed on wkf activity with kind=flowstop

Status in OpenERP Server:
  New

Bug description:
  I am trying to send a mail when a holiday request is
  confirmed/accepted/refused, using the 'email_template' module. For
  that, I developped a small module "hr_holidays_mail", see enclosed.

  It works well when the holiday request is confirmed and accepted, but
  it doesn't work when the holiday request is refused.

  After some investigation, I found out that :

  In addons-trunk/hr_holidays/hr_holidays_workflow.xml line 46 :

  the workflow activity "refuse" is of kind 'stopall' (is was not the
  case in OpenERP 5.0 ; it is the case since OpenERP 6.0)

  In server-trunk/openerp/workflow/workitem.py line 122 :

  when kind == 'stopall', it doesn't consider the 'action_id' of the workflow activity.
  Instead, if you look line 99, when kind == 'dummy' or 'function', you see this code which executes the server action :

  if activity['action_id']:
      res2 = wkf_expr.execute_action(cr, ident, workitem, activity)
      if res2:
          stack.append(res2)
          result=res2

  So, what is the good solution if I want to send an email when a holiday request is refused ?
  1) in addons/hr_holidays, modify the kind of the workflow activity "refuse" from "stopall" to "dummy" ?
  2) patch the server to execute the server action on an activity with kind = flowstop ?

  All suggestions are welcomed !

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


Follow ups

References