odoo 8 using domain force to show record within same group

Viewed 74

I have this xml

    <record model="ir.module.category" id="module_team_security">
        <field name="name">Team Security</field>
        <field name="sequence">14</field>
    </record>
    <record id="group_sale_salesman_order" model="res.groups">
        <field name="name">User: Own Order Only</field>
        <field name="category_id" ref="ts_addons_tbk.module_team_security"/>
        <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
        <field name="comment">the user will have access to his own order in the sales application.</field>
    </record>
    <record id="group_sale_salesman_team_orders" model="res.groups">
        <field name="name">User: Own Order Team</field>
        <field name="category_id" ref="ts_addons_tbk.module_team_security"/>
        <field name="implied_ids" eval="[(4, ref('group_sale_salesman_order'))]"/>
        <field name="comment">the user will have access to team records of sales application.</field>
    </record>

    <record id="sale_order_rule_personal" model="ir.rule">
        <field name="name">Personal Sale Order</field>
        <field ref="sale.model_sale_order" name="model_id"/>
        <field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field>
        <field name="groups" eval="[(4, ref('group_sale_salesman_order'))]"/>
    </record>
    <record id="sale_order_rule_team" model="ir.rule">
        <field name="name">Sale Order Team</field>
        <field ref="sale.model_sale_order" name="model_id"/>
        <field name="domain_force">[('user_id','=',user.id)]</field>
        <field name="groups" eval="[(4, ref('group_sale_salesman_team_orders'))]"/>
    </record>

The case is like this. If I choose own order than it show only the record of the user who login only. If I choose own order team than it will show the record of users where the user loged belongs.

For the own order is no problem. But the problem is for ownn order team

This is the table of sales_group_approval:

id | name   | leader_id
1  | team 1 | 1
2  | team 2 | 2

This is the table of sales_group_approval:

id | member_group_id | member_id
1  | 1               | 3
2  | 1               | 4
3  | 2               | 5
4  | 2               | 6

The result of what I look for is where user 1 login than it will show record of user 1, 3 and 4. If user 2 login than the record will show record of user 2, 5 and 6.

0 Answers
Related