Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top