Search Here

Set Multiple Domain Filter on Many2many Field Onchange of Many2one in Odoo

 In this article, you will learn how to set or return multiple search filters in the domain on the Many2many field in Odoo. For example, we want to return domain (on Many2many field) based on multiple search filters on onchange of multiple Many2one fields.

How to Return Multiple Search Filters in Domain for Many2many Field

How to Return Multiple Search Filters in Domain for Many2many Field

Read More: Return Domain on Onchange on Many2one Field in Odoo

To achieve this we are going to use onchange method of Odoo. And on onchange of multiple Many2one fields, we are going to set more than one search filter for our Many2many field. 

Read More: List of Domain Search Operators in Odoo

return_multiple_search_filters_on_many2many_domain_odoo.py

In the above code first, we have created an empty python dictionary (res) and set the key of the dictionary as "domain" and assign value to that key (res['domain']) as the dictionary of the Many2many field and initialize it as an empty Python List

Read More: Set Domain on Many2many Field in Odoo

After that, we appended the multiple search filters in the form of a tuple and assigned that tuple to our "res" dictionary named (res['domain']). In the end, we have to return this dictionary to filter records in the Many2many field.

Post a Comment

0 Comments