Odoo Help

Welcome!

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.

0

Show child_ids invoices of a partner

By
Victor Godayer
on 8/19/14, 10:13 AM 729 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"?>
    <openerp>
    <data>

    <!--  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"/>
                </tree>
              </field>
            </group>
          </page>
        </page>
      </field>
    </record>


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 !

Cheers

 

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

1 follower(s)

Stats

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