[IMP] account,*: new method in ir_action_report returning if invoice

*: account_edi, l10n_ch

closes odoo/odoo#149810

X-original-commit: 9dae0a06a1f77355ed1cdf7a605d085e640b974c
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Co-authored-by: Florian Gilbert <flg@odoo.com>
This commit is contained in:
remi-filament
2024-01-20 00:29:56 +00:00
committed by Florian(flg)
co-authored by Florian Gilbert
parent 4380131b52
commit 2ecbfdb363
3 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -44,10 +44,13 @@ class IrActionsReport(models.Model):
}
return collected_streams
def _is_invoice_report(self, report_ref):
return self._get_report(report_ref).report_name in ('account.report_invoice_with_payments', 'account.report_invoice')
def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
# Check for reports only available for invoices.
# + append context data with the display_name_in_footer parameter
if self._get_report(report_ref).report_name in ('account.report_invoice_with_payments', 'account.report_invoice'):
if self._is_invoice_report(report_ref):
invoices = self.env['account.move'].browse(res_ids)
if self.env['ir.config_parameter'].sudo().get_param('account.display_name_in_footer'):
data = data and dict(data) or {}
@@ -16,7 +16,7 @@ class IrActionsReport(models.Model):
if collected_streams \
and res_ids \
and len(res_ids) == 1 \
and self._get_report(report_ref).report_name in ('account.report_invoice_with_payments', 'account.report_invoice'):
and self._is_invoice_report(report_ref):
invoice = self.env['account.move'].browse(res_ids)
if invoice.is_sale_document() and invoice.state != 'draft':
to_embed = invoice.edi_document_ids
+1 -1
View File
@@ -33,7 +33,7 @@ class IrActionsReport(models.Model):
if not res_ids:
return res
report = self._get_report(report_ref)
if report.report_name in ('account.report_invoice_with_payments', 'account.report_invoice'):
if self._is_invoice_report(report_ref):
invoices = self.env[report.model].browse(res_ids)
# Determine which invoices need a QR.
qr_inv_ids = []