Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Define group restrictions for a workflow transition in xml

By
Tobias Wetzel
on 7/16/15, 8:34 AM 1,114 views

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"

/>


3
Lucio
On 7/16/15, 9:45 AM

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!

2

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 7/16/15, 11:47 AM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/16/15, 8:34 AM
Seen: 1114 times
Last updated: 7/17/15, 4:24 AM