Odoo Help

0

dependent Dropdowns

By
Jack
on 11/3/16, 11:25 AM 412 views

hi,

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?

2
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.

Register

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

1 follower(s)

Stats

Asked: 11/3/16, 11:25 AM
Seen: 412 times
Last updated: 11/8/16, 5:25 AM