[FIX] account: display invoice report in journal items view

Create an invoice
Send & Print
Go to Journal items
Select created invoice line

Issue: No preview is shown
This occurs because the attachment was created with res_field
'invoice_pdf_report_file'
When we search without res_field the method _search of
ir.attachment will add ('res_field', '=', False) to the domain
So we don't find the generated report

opw-3301344
opw-3271602

closes odoo/odoo#122183

X-original-commit: 4a88945fb125716f4362252795e969f36b48391d
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2023-05-24 11:53:36 +02:00
parent ad8e80c90a
commit d95ef62181
+5 -1
View File
@@ -2878,7 +2878,11 @@ class AccountMoveLine(models.Model):
def _get_attachment_domains(self):
self.ensure_one()
domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.move_id.id)]]
domains = [[
('res_model', '=', 'account.move'),
('res_id', '=', self.move_id.id),
('res_field', 'in', (False, 'invoice_pdf_report_file')),
]]
if self.statement_id:
domains.append([('res_model', '=', 'account.bank.statement'), ('res_id', '=', self.statement_id.id)])
if self.payment_id: