As invoice is “printed” when invoice is posted, report invoice could be added as attachment in the ubl peppol bis 3 file. Here’s an example with a report saved as pdf file (still needs improvements).
Adding a property to convert report in base64 in account_invoice/invoice.py
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
@property
def base64_report(self):
if self.invoice_report_cache:
return (base64.b64encode(self.invoice_report_cache)).decode('ascii')
For me it is a matter to use the European tax identifier instead of the local tax identifier on the invoice.
Now I do not know how I could enforce this except by removed national identifier from the tax identifiers (but it is not backward compatible).
I seems it should be at least one of <cbc:BuyerReference> or <cac:OrderReference> / <cbc:ID>.
I guess for <cbc:BuyerReference> we could fill with the Invoice.reference if filled.
And for <cac:OrderReference> / <cbc:ID> it should be the origin but the problem is that Tryton may have multiple origins.
As far as I understand despite the documentation for <cbc:DocumentTypeCode> saying that the default value is 130 (which was the reason I set it to this value).
This code 130 seems to indicate that the document is not attached but just providing via the <cbc:ID>.