Odoo Help


dependent Dropdowns

on 11/3/16, 11:25 AM 573 views


we have two custom modules (ModuleA and ModuleB) that are On2Many related. (MainCategory and SubCategory)

Products have Many2One relations to ModuleA and to ModuleB.

If a user edits a Product and selects a ModuleA (MainCategory) Record the other Dropdown for ModuleB (Subcategory) should only show Subcategories that have a relation to the previously selected ModuleA (MainCategory)

how can this be achieved?


Nilmar Shereef

--Nilmar Shereef--
| 5 4 7
Bur Dubai, United Arab Emirates
--Nilmar Shereef--

Python Developer. Odoo Techno Functional Consultant.

Nilmar Shereef
On 11/4/16, 12:59 AM

Hi JAck,
I think adding domain filter may solve your problem.

Please add the below portion in your product xml view:

<field name="main_cate"/>   

<field name="sub_cate" domain="[('parent_cate', '=', main_cate)]"/>

Ensure that you defined two fields in product py file like below:

main_cate = fields.Many2one('main.cate', string="Main Category", required=True)   

sub_cate = fields.Many2one('sub.cate', string="Sub Category", required=True)

Also ensure the field name "parent_cate" is there in sub.cate model (M2o with 'main.cate')

Hope this may help you.

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.


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

2 follower(s)


Asked: 11/3/16, 11:25 AM
Seen: 573 times
Last updated: 4/26/18, 5:53 AM