Display Sum of overdue payments in Customer Form view for each customer
<p>In accounting -> Customer Invoices, there is a filter called <code>Overdue</code>. Now I want to calculate the overdue payments per user and then display it onto the customer form view.
I just want to know how can we apply the condition of <strong>filter</strong> in python code. I have already defined a smart button to display it with a (total invoice value) by inheriting account.invoice.</p>

<p>"Overdue" filter in invoice search view:</p>

<p><code>['&amp;', ('date_due', '&lt;', time.strftime('%Y-%m-%d')), ('state', '=', 'open')]</code></p>

<p>Your smart button on partners should use a new action, like the button for customer or vendor bills. This button definition should include <code>context="{'default_partner_id': active_id}</code> which will allow to change the partner filter later on, or the upcoming action definition should include the partner in its domain.
The action should be for model <code>account.invoice</code> and have to have the following domain:
<code>[('date_due', '&lt;', time.strftime('%Y-%m-%d')), ('state', '=', 'open')]</code></p>

<p>If you want to filter only outgoing (customer invoices) add a filter tuple for field <code>type</code>.</p>

python openerp odoo-9