[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 <xbo@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Panagiotis Kyriakou
2022-10-27 14:41:28 +02:00
parent 6acc85639a
commit 7c06316aac
+4 -2
View File
@@ -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()]