This question has been flagged
3 Replies
5286 Views

Hi,

I would like to add filter to a embedded tree view (tree view inside a <notebook> tag).

Here is my source code

<!-- Mrp Production form view -->
<record id="mrp_production_inherit_view" model="ir.ui.view">
<field name="name">mrp.production.form.inherit</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_raw_ids']" position="attributes">
<attribute name="domain">[('parent_id', '=', False)]</attribute>
</xpath>
</field>
</record>

And I also try with this one

<!-- Mrp Production form view -->
<record id="mrp_production_inherit_view" model="ir.ui.view">
<field name="name">mrp.production.form.inherit</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_raw_ids']/tree" position="attributes">
<attribute name="domain">[('parent_id', '=', False)]</attribute>
</xpath>
</field>
</record>

And here is the destination view

<notebook>
<page string="Consumed Materials">
<field name="move_raw_ids" attrs="{'readonly': [('is_locked', '=', True)]}">
<tree delete="0">
<field name="product_id" required="1"/>

Thanks for any help!

Avatar
Discard

What do you want to achieve? What information do you have about errors? What model does the parent_id field come from?

Author

Hi, Zbik.

Let's say I have a list of stock.move (move_raw_ids) like below:

- Move 1

- Move 1.1 (parent_id = Move 1)

- Move 1.2 (parent_id = Move 1)

- Move 2

I would like to display this list in a tree inside <notebook> tag.

Currently, it displays all of 4 moves on the tree.

However, I just want to display Move 1 & Move 2 only by filter ['parent_id', '=', False].

Thank you in advance!

Best Answer

Hi @thanhps, have you found any solution for this ? i have same requirement. 

Avatar
Discard