Skip to Content
Menu
This question has been flagged
3 Replies
11713 Views

I used Odoo 9 sharing products for multiple company.

How to set domain company_id in "ir.actions.act_window" so that every user can only see their own products. 

I also look for Record Rules, but it restrict another company's product in many2one field .

I try this but still not work.

<record id="mmg_product_template_mitra_action" model="ir.actions.act_window">

<field name="name">Products</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">product.template</field>

<field name="view_mode">kanban,tree,form</field>

<field name="view_type">form</field>

<field name="view_id" ref="product.product_template_kanban_view"/>

<field name="context">{"search_default_filter_to_sell":1,"custom":1}</field>

<field name="domain">[('company_id','=',user.company_id)]</field>

<field name="help" type="html">

<p class="oe_view_nocontent_create">

Click to define a new product.

</p><p>

You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to customers.

</p><p>

The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.

</p>

</field>

</record>

Avatar
Discard
Best Answer

Lo resolvi asi:

<field name="domain">[('company_id','=',allowed_company_ids[0])]</field>

Avatar
Discard
Best Answer

Hello,


Try this :-

<field name="domain">[('company_id','=',user.company_id.id)]</field>


Hope this will works.

Thanks,

Avatar
Discard
Author

its also not working 'user' cannot be located in parent view

Related Posts Replies Views Activity
2
Oct 21
7534
0
Oct 17
2227
2
Apr 24
2799
6
Aug 20
7650
5
Jun 20
4964