Dynamic Domain With Studio
Dynamic Domain With Studio
STORY BEHIND THE FEATURES
ODOO BEHAVIOUR
Odoo Studio allow adding domain to field but it is not dynamic.
CLUEDOO BEHAVIOUR
Cluedoo allows specifying dynamic domain for a field in a view using the value of another field in that view.
By putting a domain as computed in a char field, user can use this field as a domain for target field.
CLUEDOO RECOMMENDATION
To be installed in 100% of your database.
HOW TO USE MODULE
HOW TO USE MODULE
EXAMPLE
User requirement:
On Contact form, assign only Sales Teams who are responsible of Client's industry.
Technical Requirement:
On Contact form, make field Sales Team (team_id) takes domain from field Industry (industry_id).
Step 1: Create domain field type char with advanced properties as below:
Dependencies:
industry_id
Compute:
for record in self:
industry = record.industry_id
a = """[["x_studio_many2many_field_czjSL","=",%s]]"""%(industry.id)
record.write({'x_studio_domain_sales_team_1': str(a)})
Result:
Step 2: Use view to add domain to target field:
1. Make sure developer mode is activated
2. Click on bug icon/ Edit View: Form
3. Go to Inherited Views tab, open Odoo Studio customization view
4. Add field x_studio_domain_sales_team_1 to field team_id's domain.
Result:
Field Sales Team only suggest Teams shares the same industry with Contact.