[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
This commit is contained in:
parent
8b2c8dc0d1
commit
3eda25119f
|
@ -133,6 +133,7 @@
|
|||
<field name="amount_untaxed" sum="Untaxed Amount"/>
|
||||
<field name="amount_total" sum="Total Amount"/>
|
||||
<field name="state"/>
|
||||
<field name="type" invisible="context.get('type',True)"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -496,6 +497,17 @@
|
|||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_refund_out_tree" model="ir.actions.act_window">
|
||||
<field name="name">Invoices</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="view_id" ref="invoice_tree"/>
|
||||
<field name="domain">[('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel'])]</field>
|
||||
<field name="context">{'type':False}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_tree_pending_invoice" model="ir.actions.act_window">
|
||||
<field name="name">Pending Invoice</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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}">
|
||||
<div><strong><field name="total_invoiced" widget="monetary"/></strong><br/>Invoiced</div>
|
||||
|
|
Loading…
Reference in New Issue