From 7c06316aac6884e90a9cd1700fcc825dc7d6583e Mon Sep 17 00:00:00 2001 From: Panagiotis Kyriakou Date: Wed, 19 Oct 2022 15:03:43 +0000 Subject: [PATCH] [FIX] sale_project: fix project invoice traceback In this commit we fix two tracebacks that are returned when the user tries to click on the invoice/vendor bills smart buttons in the "project updates" view. Also added credit notes to the "invoices/vendor bills" smart button of the "project update" view. task-3033278 closes odoo/odoo#104300 X-original-commit: 4f1981fb54fe726801318ad66b941a20affa0d4a Signed-off-by: Xavier Signed-off-by: Laurent Stukkens (ltu) --- addons/sale_project/models/project.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/sale_project/models/project.py b/addons/sale_project/models/project.py index 3b9a0fe4091..1f70cb886d3 100644 --- a/addons/sale_project/models/project.py +++ b/addons/sale_project/models/project.py @@ -152,8 +152,9 @@ class Project(models.Model): return action def action_open_project_invoices(self): - query = self.env['account.move.line']._search([('move_id.move_type', '=', 'out_invoice')]) + query = self.env['account.move.line']._search([('move_id.move_type', 'in', ['out_invoice', 'out_refund'])]) query.add_where('analytic_distribution ? %s', [str(self.analytic_account_id.id)]) + query.order = None query_string, query_param = query.select('DISTINCT move_id') self._cr.execute(query_string, query_param) invoice_ids = [line.get('move_id') for line in self._cr.dictfetchall()] @@ -447,8 +448,9 @@ class Project(models.Model): return buttons def action_open_project_vendor_bills(self): - query = self.env['account.move.line']._search([('move_id.move_type', '=', 'in_invoice')]) + query = self.env['account.move.line']._search([('move_id.move_type', 'in', ['in_invoice', 'in_refund'])]) query.add_where('analytic_distribution ? %s', [str(self.analytic_account_id.id)]) + query.order = None query_string, query_param = query.select('DISTINCT move_id') self._cr.execute(query_string, query_param) vendor_bill_ids = [line.get('move_id') for line in self._cr.dictfetchall()]