Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
13248 Lượt xem

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>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Lo resolvi asi:

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,


Try this :-

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


Hope this will works.

Thanks,

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 21
9170
0
thg 10 17
3041
2
thg 4 24
4223
6
thg 8 20
9183
5
thg 6 20
5893