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.
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?
I think adding domain filter may solve your problem.
Please add the below portion in your product xml view:
<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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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: 11/3/16, 11:25 AM|
|Seen: 186 times|
|Last updated: 11/8/16, 5:25 AM|