From 3eda25119fa2de39a07f073269a42f317dc0d61b Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 25 Mar 2015 16:31:21 +0100 Subject: [PATCH] [FIX] account: Invoiced doesn't take into account cancelled invoices "Invoiced" stat button on the res.partner form view must not include cancelled and draft invoices. The button triggered an action which shows a tree view with invoices where: type in ['out_invoice'] and all states. Now the button triggers a tree view with invoices where: type in ['out_invoice' , 'out_refund'] and state not in ['draft', 'cancel']. opw:472318 --- addons/account/account_invoice_view.xml | 12 ++++++++++++ addons/account/partner.py | 2 +- addons/account/partner_view.xml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 4e2e041efea..b692f4e55c2 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -133,6 +133,7 @@ + @@ -496,6 +497,17 @@ + + Invoices + account.invoice + form + tree,form,calendar,graph + + [('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel'])] + {'type':False} + + + Pending Invoice account.invoice diff --git a/addons/account/partner.py b/addons/account/partner.py index 416ecf5fbbf..3df24382164 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -242,7 +242,7 @@ class res_partner(osv.osv): result = {} account_invoice_report = self.pool.get('account.invoice.report') for partner in self.browse(cr, uid, ids, context=context): - domain = [('partner_id', 'child_of', partner.id)] + domain = [('partner_id', 'child_of', partner.id), ('state', 'not in', ['draft', 'cancel'])] invoice_ids = account_invoice_report.search(cr, uid, domain, context=context) invoices = account_invoice_report.browse(cr, uid, invoice_ids, context=context) result[partner.id] = sum(inv.user_currency_price_total for inv in invoices) diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index ebc485c5f76..a85b27882c4 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -77,7 +77,7 @@ class="oe_stat_button" id="invoice_button" icon="fa-pencil-square-o" - name="%(account.action_invoice_tree)d" + name="%(account.action_invoice_refund_out_tree)d" attrs="{'invisible': [('customer', '=', False)]}" context="{'search_default_partner_id': active_id,'default_partner_id': active_id}">

Invoiced