Odoo Help

0

How to get company_id in xml

By
Ajeng Shilvie
on 7/29/16, 5:59 AM 1,460 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--
3110
| 6 5 8
Surat, India
--Jignesh Mehta--

- I have 3+ years of Industry Experience, specializing Odoo Development, Analysis, Customization, Implementation, Integration.
- I have done many Customization modules in Sale, Purchase, Point of Sale, Inventory, CRM and much more. Also Worked in the Odoo Themes like Business Theme or E-Commerce Theme.
- Develop Jewelery Manufacturing process from Scratch. It have more than 10 Department. Develop PDF and Excel reports for this project around 150 per format.

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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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