Ayuda

2

Is it possible to have different task stages visible for some groups?

Avatar
Mathews Jose

Hi,

I need to acess different task stages for different users group.
I need to hide some task stages for some groups.

Thank you.

Avatar
Descartar
1 Respuesta
2
Best Answer

Yes, it is possible using groups and rules.

To prove that I applied the following code on my budget module 'budget_expense' . I needed some users to see only the 'draft' budget, others to see the 'confirm' ones, I wrote the following groups and rules.

this is the category: 

<record model="ir.module.category" id="module_category_special">
<field name="name">Budget Miscelenious</field>
<field name="description">Budget Miscelenious</field>
        <field name="sequence">26</field>
</record>

following are two groups

<record id="group_test01" model="res.groups">
<field name="name">Show only 'Draft'</field>
        <field name="category_id" ref="budget_expense.module_category_special"/>
field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="group_test02" model="res.groups">
<field name="name">Show only 'confirmed'</field>
<field name="category_id" ref="budget_expense.module_category_special"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

following are two rules, a rule for each group

<record model="ir.rule" id="apply_rule_on_draft">
<field name="name">test01</field>
<field name="model_id" ref="budget_expense.model_budget_expense"/>
<field name="domain_force">
[('state','=','draft')]
</field>
<field name="groups" eval="[(4, ref('budget_expense.group_test01'))]"/> <field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_unlink" eval="True"/>
<field name="perm_create" eval="True"/>
</record>
<record model="ir.rule" id="apply_rule_on_confirm">
<field name="name">test02</field>
<field name="model_id" ref="budget_expense.model_budget_expense"/>
<field name="domain_force">
[('state','=','confirm')]
</field>
<field name="groups" eval="[(4, ref('budget_expense.group_test02'))]"/> <field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_unlink" eval="True"/>
<field name="perm_create" eval="True"/>
</record>

If you need a user to see only the 'draft' status, assign him to the group 'group_test01'

If you need a user to see only the 'confirm' status, assign him to the group 'group_test02'

if you need him to see both states, assign him to both groups

I explained the idea on my code that I tested it and already got result from it, you can imitate exactly the same idea on your case

Avatar
Descartar