Hello,
I built a view like this, in which I would like to filter the lines of the Notebook (O2M), following the values that I will select at the main field of the view ( banque and projet) . as i have dificulties to put image here, you can see my screenshot \here ( \https://www.developpez.net/forums/d2011774/logiciels/solutions-d-entreprise/erp/odoo-ex-openerp/filtrer-one2many-l-aide-d-chant-many2one-odoo12/ ).
view code:
{{<record id="view_btp_etatcaution_form" model="ir.ui.view"> <field name="name">etatcaution</field> <field name="model">btp.etatcaution</field> <field name="arch" type="xml"> <form string="etatcaution" class="oe_form_configuration" create="false"> ... <sheet> <group> <field name="banque_id" class="oe_inline"/> <field name="projet_id" class="oe_inline"/> </group> </sheet> <notebook> <page string="Etat caution"> <field name="ligne_caution_etat" widget="select"> <tree editable="bottom" string="Etat caution" create="false"> <field name="name"/> .... <field name="banque_id" domain="[('banque_id', '=', parent.banque_id)]"/> <field name="projet_id" domain="[('projet_id', '=', parent.projet_id)]" /> <field name="date_debut"/> .... </tree> </field> </page> </notebook> </form> </field> </record> <record id="action_etatcaution" model="ir.actions.act_window"> <field name="name">etatcaution</field> <field name="type">ir.actions.act_window</field> <field name="res_model">btp.etatcaution</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="res_id">1</field> <field name="view_id" ref="view_btp_etatcaution_form"/> </record>}}
i dont know why this part doesn't filter my list:
{{ <field name="banque_id" domain="[('banque_id', '=', parent.banque_id)]"/> <field name="projet_id" domain="[('projet_id', '=', parent.projet_id)]" /> }}
The code is not clear, normally parent in one2many will be the inverse relation. ie, relation. please update the python code also