[FIX] account: remove constraint when printing original bills

This constraint did not exist prior to version 16.0 and was
added here : https://github.com/odoo/odoo/commit/7c4e591d58dd2b882f0c237d52490b2756c94203

But this feature is used by fiduciaries for printing customer
invoices, which is why we are removing it here.

No task, internal feedback.

closes odoo/odoo#127490

X-original-commit: d54bae78db25dc62687e3afc64f8699dfbfd5cf8
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
John Laterre (jol)
2023-07-05 18:46:58 +02:00
parent 910456b397
commit 2950c449de
@@ -20,9 +20,6 @@ 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(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 purchase document could be found for any of the selected purchase documents."))