Odoo Help


Show child_ids invoices of a partner

Victor Godayer
on 8/19/14, 10:13 AM 1,159 views

I'd like to show invoices adressed to child partner in the parent partner form view.

I've already a inherited res_partner model as follow :

    class res_partner(osv.osv):
        _inherit = 'res.partner'
        _columns = {
            'invoice_ids': fields.one2many('account.invoice', 'partner_id', 'Invoices'),

And a view displaying invoices as follow :

    <?xml version="1.0"?>

    <!--  Partners inherited form -->
    <record id="view_history_partner_info_form" model="ir.ui.view">
      <field name="name">res.partner.cap_history.form.inherit</field>
      <field name="inherit_id" ref="base.view_partner_form"/>
      <field name="model">res.partner</field>
      <field name="arch" type="xml">
        <page string="Accounting" position="after" version="7.0">
          <page string="History" name="cap_history_tab">
            <group name="grp_invoice_history" string="Invoices History">
              <field name="invoice_ids" colspan="4" nolabel="1">
                <tree string="Partner Invoices"  create="false" delete="false">
                  <field name="number" readonly="True"/>
                  <field name="origin" readonly="True"/>
                  <field name="name" string="Reference" readonly="True"/>
                  <field name="date_invoice" readonly="True"/>
                  <field name="x_category" readonly="True"/>
                  <field name="state" readonly="True"/>
                  <field name="payment_term" readonly="True"/>
                  <field name="amount_total" readonly="True"/>

With this code I can see invoices that are directly adressed to a company or a person on their respective form view.
But if an invoice is adressed to person, and none is adressed to the parent company, when I am on the company form view, I won't see the invoice adressed to the child contact.

Is there a way to make visible the contact's invoice in the parent partner form view ?

Thank you for your help !



About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/19/14, 10:13 AM
Seen: 1159 times
Last updated: 3/16/15, 8:10 AM