Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
6632 Представления

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"

/>


Аватар
Отменить
Лучший ответ

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!

Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
июн. 16
4131
3
мар. 16
2094
0
мар. 15
4196
0
сент. 20
6104
7
апр. 17
13338