Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I wanted to set the domain criteria dynamically on the window action (ir.actions.act_window) for specific user.
Note: I don't want to use any Security Rules on the object, though it gives the result what am looking for, but it is a hindrance in couple of places wherein it fails to perform my internal functionality.
In other words, User should not have visual access to couple of records, but should be available to perform the internal actions.
Best Example, I can take is Partners:
Under "Contacts" menu, Both Supplier & Customer contacts are been shown.
Now I want to filter the contacts which are shown in that Contact menu according to the User.
Say User A (belonging to SalesGroup) should access to view Customer Contacts in that menu, User B (belonging to PurchaseGroup) should be able to see only Suppliers in that menu.
But this should not affect Sale/Purchase Contacts w.r.t Sale/Purchase orders.
Any help appreciated.
You can use "uid" variable in right hand side of domain to manage dynamic domain inside any window action. Please have a look inside below example.
<record model="ir.actions.act_window" id="action_note_stage">
<record id="expense_all" model="ir.actions.act_window">
<field name="name">My Expenses</field>
<field name="search_view_id" ref="view_hr_expense_filter"/>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
I hope you will get dynamic domain as you want from above examples.
Note : You can use some predefined variables in domain like : uid, active_id, active_ids, time etc.
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
|Asked: 5/18/16, 4:03 AM|
|Seen: 860 times|
|Last updated: 11/10/16, 6:15 AM|