Search code examples
pythonpython-2.7odooodoo-8

How to add product in filter


I want to add product filter in account invoice model. How to do it?Any help appreciated. Is it can be done by using related field?

enter image description here


Solution

  • Just add new "field" filter in the search view:

    <field name="invoice_line" string="Product" 
        filter_domain="[('invoice_line.product_id', 'ilike', self)]" />
    

    For newer Odoo Versions (field name changed):

    <field name="invoice_line_ids" string="Product" 
        filter_domain="[('invoice_line_ids.product_id', 'ilike', self)]" />