Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
6606 Vistas

Hi,

in the Odoo docs it says:

Workflow transitions can be restricted to a specific group. Users outside the group can not trigger the transition.

How can I achieve this in the xml definition of the transition?

This is my transition definition:

<record model="workflow.transition" id="paper_reviewed_to_accepted">
<field name="act_from" ref="paper_reviewed"/>
<field name="act_to" ref="paper_accepted"/>
<field name="signal">accepted</field>
</record>


SOLUTION:

make the transition only available to a group:

<record model="workflow.transition" id="paper_reviewed_to_accepted">    
    <field name="act_from" ref="paper_reviewed"/>
    <field name="act_to" ref="paper_accepted"/>
    <field name="group_id" ref="module.xml_id_of_the_group"/>
    <field name="signal">accepted</field>
</record>

If you have a button to trigger the transition it is still visible to everybody. To only make it visible to the group, for which the transition is available, do:

<button name="in_review" type="workflow" string="Set to In Review"
    states="submitted" class="oe_highlight"
    groups="module.xml_id_of_the_group"

/>


Avatar
Descartar
Mejor respuesta

Hi, it is as simple as adding the following tag:


<field name="group_id" ref="module.xml_id_of_the_group"/> 


Leaving your transition as:

<record model="workflow.transition" id="paper_reviewed_to_accepted"> 
<field name="act_from" ref="paper_reviewed"/>
<field name="act_to" ref="paper_accepted"/>
<field name="group_id" ref="module.xml_id_of_the_group"/>
<field name="signal">accepted</field>
</record>

 Hope it helps!

Avatar
Descartar
Mejor respuesta

You must proceed with what Lucio has explained. That answer is pretty right.

In an additional logic, you can set the groups on button which triggers the signal.

Example : <button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>

Thanks.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 16
4117
3
mar 16
2094
0
mar 15
4192
0
sept 20
6095
7
abr 17
13331