0
votes

In odoo8 (Multi-company module is installed on it) I like to show the projects of the current company BUT NOT sub companies. when I add this line to the SearchView XML file:

<filter string="Company" domain="[('company_id', '=', 1)]"/> 

It works correctly (1 is the root company id). But when i change it to :

<filter string="Company" domain="[('company_id', '=', [user.company_id.id])]" />

I get this error:

Uncaught Error: Failed to evaluate search criterions: 

{"code":400,"message":"Evaluation Error","data": {"type":"local_exception","debug":"Local evaluation failure\nNameError: name 'user' is not defined\n\n{\"domains\":[[],\"[('company_id', '=',[user.company_id.id])]\"],\"contexts\": [{\"lang\":\"en_US\",\"tz\":\"America/Montreal\",\"uid\":1,\"search_default_Company\":1},\"{'group_by':'company_id'}\"],\"group_by_seq\":[\"{'group_by':'company_id'}\"]}"}}

I appreciate if you tell me how can I pass the id of current company to the filter.

Thanks,

1

1 Answers

0
votes

You need to create a record rule for your model and not in the search view. in settngs/technical/security/record rules, you can seen many record rules.