OCA / edi

GNU Affero General Public License v3.0
121 stars 309 forks source link

[16.0] account_invoice_facturx: No data attached if invoice is sent per mail #1045

Open alpha23 opened 1 month ago

alpha23 commented 1 month ago

Module

account_invoice_facturx

Describe the bug

When I download an invoice via Print -> Invoices, the facturx data is correctly inserted into the PDF. If I want to send an invoice by e-mail, no data is inserted into the PDF. The attachment in the e-mail does not contain any facturx data.

How can I ensure that the invoices sent by e-mail contain the correct data?

Steps to reproduce the behavior:

  1. Install the modules account_einvoice_generate and account_invoice_facturx with the default settings
  2. compare the PDFs that are to be sent by mail and those that are to be printed

Expected behavior The PDF in the mail attachment should include the facturx data

alpha23 commented 1 month ago

When I go to Print -> Invoices, the variable “report_ref” in the method models/ir_actions_report.py:_render_qweb_pdf_prepare_streams is a string with the content “account.report_invoice_with_payments”. If I use the “Send & print” button, I get a model “ir.actions.report(202,)” for the variable. The check “and report_ref in invoice_reports” then fails with error: “UserWarning: unsupported operand type(s) for ‘==’: ‘ir.actions.report()’ == ‘’account.report_invoice_with_payments‘’”.

For now I solved it with:

if not isinstance(report_ref, str): report_ref = report_ref.report_name