server action not executed on wkf activity with kind=flowstop

Bug #1012684 reported by Alexis de Lattre
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Low
OpenERP's Framework R&D

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 !

Revision history for this message
Alexis de Lattre (alexis-via) wrote :
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.