← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 706886] Re: workflow 'group required' field not working

 

Just for the record, here's the comment I added on question 142664:

Hello Colin,

Following-up to you question, I think it has not been made very clear how the "Required Group" option affects the workflow transition.
What effectively happens inside workflows is that a transition will "fire" in the following manner:
- if a "signal" is set on the transition, that signal must be sent to the workflow for the transition to fire. Signals are usually sent by buttons of type "workflow".
- if a "condition" is set on the transition, it will prevent firing until the condition evaluates to "True" (even if a signal is received)
- if a "signal" *and* "Required Group" are set on the transition, it will prevent firing (even if the condition evaluates to True) until the given signal is sent by a user who belongs to the "Required group". A signal sent by someone else will just be ignored by the worflow. 

As buttons are the usual way to send signals, having the signal should mean that when you press the button (type=workflow) nothing happens, and this is indeed the case. However OpenERP has an additional mechanism built-in in views so that workflow buttons are also displayed disabled (kind of grayed out) when the current workflow state of the document has only one possible transition associated with that button, and the user does not belong to the "Required Group" for that transition.
This is to avoid users clicking on the button and wondering why it doesn't react. Moreover, we usually hide the button completely using different techniques (as mentioned by Amit) when it would only confuse users.

Note that this mechanism of disabling the workflow buttons is done
server-side, so you need to close and reopen the forms/menus in your
client to notice the difference (logout/login if you want to be sure).

And one more thing: do not test the flows as the Administrator! This is
because the Administrator is not restricted by the "Required Group" on a
transition, even when he does not belong to that required group.

To conclude, in your example of the purchase order workflow, if you modify the transition from Draft to Confirmed as follows:
- condition = True
- signal = "purchase_confirm" (to be sent by the corresponding button in purchase order form)
- group = "Purchase / Manager"
and make sure to save the change and also logout/login with a non-admin account, you should see that the "Convert to Purchase Order" button on Quotations becomes grayed out automatically if the current user is not member of the "Purchase / Manager" group.

I hope this helps...

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/706886

Title:
  workflow 'group required' field not working

Status in OpenERP Modules (addons):
  Invalid

Bug description:
  As an example, the Purchase Order workflow ...

  The Draft state has two outgoing transitions - Confirmed
  (purchase_confirm) and Cancel (purchase_cancel).

  If I create a 'Group Required' entry for the confirmed transition.
  Nothing happens.  If my user does not have that group assigned, I
  *should* be prevented from moving along the next stage of the
  workflow.

  I checked the code (but I'm not a programmer) and it does not look
  like the Group Required field is evaluated.  Check -
  wkf_confirm_order()

  I might be missing something but it does not seem that this
  functionality has been implemented.

  I also checked Sales Orders with the same result.





References