Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to get company_id in xml

By
Ajeng Shilvie
on 7/29/16, 5:59 AM 351 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>

1

Jignesh Mehta

--Jignesh Mehta--
2087
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 7/30/16, 5:25 AM

Hello,


Try this :-

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


Hope this will works.

Thanks,

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

Ajeng Shilvie
on 7/31/16, 7:32 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/29/16, 5:59 AM
Seen: 351 times
Last updated: 7/30/16, 5:25 AM