Question

The problem I'm about to describe I already solve it but in localhost:8069->Settings->Security->Rules. But, what I really want is to give this rule in code..maybe in XML code?

The following rule "([('employees_id.user_id','=',user.id)])", works like a charm in 'Wizard mode', but I want it on XML because it's more dynamic.

<record model="ir.ui.view" id="classA_tree">
                <field name="name">tree view</field>
                <field name="model">classA.classA</field>
                <field name="type">tree</field>
                <field name="domain">[('employees_id.user_id','=',user.id)]</field>
                <field name="arch" type="xml">
                        <tree string="jobsopen tree">
                                <field name="status"/>
                                <field name="the_name"/>
                        </tree>
                </field>
        </record>

Just to be sure, I'm currently restricting users for viewing certain menus of my module, they cannot create in this "tree" any contact, they can only view it. I tried the XML above, but without success.

Was it helpful?

Solution

You can not give filter in tree view of object, instead of you can give in action of the object

in action you can give like this:

<record model="ir.actions.act_window" id="action_employee">
        <field name="name">Employees</field>
        <field name="res_model">Employees.Employees</field>
        <field name="view_mode">tree,form</field>
        <field name="domain">[('user_id','=',uid)]</field>
    </record>

Hope this help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top