Hi,
It is possible in Odoo. Suppose if this is the case means, for group X users have to view the view A, for group Y have to view the view B and for group Z have to view the view C.
What you can do is that you can call the python function from the menu item and check the current user's group and return the view accordingly from the python function.
Calling python function from menu,
<record id="action_test" model="ir.actions.server">
<field name="sequence" eval="5"/>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_product_template"/>
<field name="code">action = model.test_function()</field>
<field name="condition">True</field>
<field name="name">Test</field>
</record>
<menuitem id='menu_test' name='Test' sequence="20" parent="purchase.menu_procurement_management"
action="action_test"/>
Python function,
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.model
def test_function(self):
action = self.env.ref('test_action').read()[0]
kanb_view_id = self.env.ref('product.product_template_kanban_view').id
form_view_id = self.env.ref('product.product_template_only_form_view').id
tree_view_id = self.env.ref('product.product_template_tree_view').id
action_context = safe_eval(action['context'])
action['views'] = [
[kanb_view_id, 'kanban'],
[tree_view_id, 'tree'],
[form_view_id, 'form']
]
action['context'] = action_context
return action
Thanks
Hello, are you trying to implement different kind of view when the model is in different status(ie, form, tree views are different when status is different)
OR
DO you just want user with group X see records containing status A only, group Y see records with status B etc
The second one
You can use Odoo's record rules.
Please refer this docs https://www.odoo.com/documentation/8.0/reference/security.html.
If you have any problem implementing it please post a new question for it