This question has been flagged
2 Replies
3814 Views

search / filter sale_order_line from Parent form 

Avatar
Discard
Best Answer

You have to do a workaround to achieve it....

product_id is present in Order lines, so if you want to make it available for Searching in Order object (parent).. you can achieve it using functional field and its search function...

In Order : add a functional field, and in _fnct_search, you write a logic to search through lines and fetch the parent ids...

Avatar
Discard
Author

it 's advance code but i'll try for me in the future thank you .

Best Answer

 

We can add filter domains.

<record id="search_view" model="ir.ui.view">
            <field name="name">name</field>
            <field name="model">sale.order</field>
            <field name="arch" type="xml">
                <search string="Search">

                       <!--Add this filter domain -->
                       <field name="order_line" filter_domain="[('order_line.product_id.name','ilike',self)]" string="Products"/>
                       <group expand="0" string="Group By...">
                       </group>
                </search>
            </field>
        </record>

Avatar
Discard
Author

Thank you it's easy code for me.