-
- Downloads
[FIX] l10n_be_edi: error at PDF generation
An UBL invoice can contain several `AdditionalDocumentReference`, some
of them without `Attachment`. For example:
```
<cac:AdditionalDocumentReference>
<cbc:ID>UBL.BE</cbc:ID>
<cbc:DocumentDescription>BOB50 6.07.0</cbc:DocumentDescription>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
<cbc:ID>Facture N°19090118 - 30-09-2019.pdf</cbc:ID>
<cbc:DocumentDescription>CommercialInvoice</cbc:DocumentDescription>
<cac:Attachment>
<cbc:EmbeddedDocumentBinaryObject filename="Facture.pdf" mimeCode="application/pdf">JVBERi0xLjMK...
...
```
In this case, a crash occurs since:
```
element.xpath('cac:Attachment//cbc:EmbeddedDocumentBinaryObject', namespaces=namespaces)
```
is an empty list.
To avoid this, we loop on all elements and generate all PDFs.
opw-2128083
closes odoo/odoo#40698
Signed-off-by:
Nicolas Martinelli (nim) <nim@odoo.com>
Please register or sign in to comment