Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to filter rows in internal tree?

on 5/29/13, 12:31 PM 1,603 views


I am trying to add a tree to res.partner form displaying all the non-paid invoices.

I managed to display the tree but I don't know how to filter rows : I want to show only the invoices that are not paid (state = open).

I tried to add a "domain" on the tree but it didn't work.

Here is my code :

<record id="view_partner_inherit_followup_form" model="ir.ui.view">
    <field name="name">res.partner.followup.form.inherit</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="model">res.partner</field>
    <field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
    <field name="arch" type="xml" >
        <page string="Accounting" position="before" version="7.0">
            <page string="Relances paiement" groups="account.group_account_invoice" name="followup_tab">
                <field name="invoices" string="Factures">
                  <tree colors="red:state == 'open'; green:state == 'paid';" domain="[('state', '==', 'open')]">
                    <field name="number" />
                    <field name="date_invoice"/>
                    <field name="colonne_due1" sum="Total 1-30" />
                    <field name="colonne_due2" sum="Total 31-45"/>
                    <field name="colonne_due3" sum="Total 46-50"/>
                    <field name="colonne_due4" sum="Total 51-60"/>
                    <field name="colonne_due5" sum="Total 61+"/>
                    <field name="amount_total" sum="Total"/>
                    <field name="state" invisible="True" />

Can anyone give me a way to show only open invoices?

On 5/30/13, 10:27 AM

I just solved my problem by adding the domain in the python code :

'factures': fields.one2many('account.invoice', 'partner_id', 'Invoices', domain=[('state','=','open')], readonly=True),

It works this way but if anyone knows why it did not work in the xml, please tell me.



Ray Carnes

--Ray Carnes--
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 5/29/13, 3:46 PM

You need the domain on the field invoices.

Try something like:

<field name="invoices" string="Factures" domain="[('state', '=', 'open')]">

I already tried it but it doesn't seems to work... Thanks anyway

on 5/30/13, 10:10 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 5/29/13, 12:31 PM
Seen: 1603 times
Last updated: 3/16/15, 8:10 AM