Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
6603 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jun. 16
4116
3
mrt. 16
2094
0
mrt. 15
4191
0
sep. 20
6094
7
apr. 17
13328