From c53cf73f367bc68b22cb752396852e2985aefb8f Mon Sep 17 00:00:00 2001 From: "Jerome Sonnet (ito-invest-lu)" Date: Tue, 28 Feb 2023 12:12:48 +0000 Subject: [PATCH] [FIX] account : fix report_original_vendor_bill to work also with refunds Before commit it you want to print original bills with report_original_vendor_bill and that your list contains a refund it ends up with a UserError "You can only print the original document for vendor bills.". Fixing the filter, using the is_purchase_document helper, allows to properly print documents, including refunds. closes odoo/odoo#115452 X-original-commit: 7dd553b8ec1bcea8487dfe71c336787f35d69bea Signed-off-by: Laurent Smet --- addons/account/models/ir_actions_report.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/ir_actions_report.py b/addons/account/models/ir_actions_report.py index 19a949b6da8..edd0ec1812c 100644 --- a/addons/account/models/ir_actions_report.py +++ b/addons/account/models/ir_actions_report.py @@ -20,12 +20,12 @@ class IrActionsReport(models.Model): return super()._render_qweb_pdf_prepare_streams(report_ref, data, res_ids=res_ids) invoices = self.env['account.move'].browse(res_ids) - if any(x.move_type not in ('in_invoice', 'in_receipt') for x in invoices): - raise UserError(_("You can only print the original document for vendor bills.")) + if any(not x.is_purchase_document(include_receipts=True) for x in invoices): + raise UserError(_("You can only print the original document for purchase documents.")) original_attachments = invoices.message_main_attachment_id if not original_attachments: - raise UserError(_("No original vendor bills could be found for any of the selected vendor bills.")) + raise UserError(_("No original purchase document could be found for any of the selected purchase documents.")) collected_streams = OrderedDict() for invoice in invoices: