Passing context to domain in Odoo 9 -
in model
batch_id = fields.many2one('ae.batch', 'batch') subject_ids = fields.many2many('ae.subject', string="subjects") topic_ids = fields.many2many('ae.topic', string="topics") subtopic_ids = fields.many2many('ae.subtopic', string="subtopics") the goal pass context in order filter(domain), picking batch filters subjects, choose subjects, 1 or more, filter topics, , filter subtopics.
batch (many2one) subjects (many2many) subjects (many2many) topics (many2many) topics (many2many) subjects(many2many)
check view:
<group col="4" name="plan_detail" string='choose t'> <field name="batch_id" context="{'batch_id':batch_id}"/> <field name="subject_ids" domain="[('batch_id', '=', batch_id)]" context="{'subject_ids': subject_ids}"/> <field name="topic_ids" domain="[('subject_id', 'in', 'subject_ids')]" context="{'topic_ids': topic_ids}" /> <field name="subtopic_ids" widget="many2many_checkboxes" domain="[('topic_id', 'in', topic_ids)]" /> what working, picking batch filters correctly subjects. stucked between subjects , topics, think context or domain problem, i've tested changing domain manually so:
<field name="topic_ids" domain="[('subject_id', 'in', '[1, 2]')]" context="{'topic_ids': topic_ids}" /> and gets topic list. guess wrong passing context or getting domain. help.
thanks in advance.
in code, in domain, field mentioned subject_ids in between quotes. since representing field remove quotes , do.
try this
<field name="topic_ids" domain="[('subject_id', 'in', subject_ids)]" context="{'topic_ids': topic_ids}" />
Comments
Post a Comment