From 3309ecbd7a4c61fac476b18642dd7e49c544f7e6 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Fri, 14 Jun 2019 07:29:27 +0000 Subject: [PATCH] [IMP] account: find easily draft invoices for a partner Requested in issue #28729 closes odoo/odoo#34114 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/partner.py | 3 ++- addons/account/views/account_invoice_view.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 4a706f93c7b..16c420fe52c 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -438,8 +438,9 @@ class ResPartner(models.Model): def action_view_partner_invoices(self): self.ensure_one() action = self.env.ref('account.action_invoice_refund_out_tree').read()[0] - action['domain'] = literal_eval(action['domain']) + action['domain'] = [('type','in', ['out_invoice', 'out_refund']), ('state', '!=', 'cancel')] action['domain'].append(('partner_id', 'child_of', self.id)) + action['context'] = {'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale', 'search_default_unpaid': 1} return action @api.onchange('company_id') diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index a55aafc795e..741c54ea79e 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -759,7 +759,7 @@ - Pending Invoice + Pending Invoices account.invoice form tree,form,calendar,graph