[FIX] account_edi_ubl_cii: no xml declaration with the send & print
Issue: the xml declaration "<?xml version='1.0' encoding='UTF-8'?>" is
lost when opening the send & print wizard with existing xml attachments.
Explanation: When opening the send and print wizard, the PDF are
generated and postprocessed by `_postprocess_pdf_report`. In the
`_postprocess_pdf_report` override in `account_edi_ubl_cii`, the xml
attachments are parsed through `tree = etree.fromstring(xml)`, then the
base64 PDF is inserted, and the etree is converted to a bytes through
`etree.tostring(cleanup_xml_node(tree))` and the resulting bytes is
written back on the attachment, but the xml declaration disappeared.
Solution: include the arguments `xml_declaration=True, encoding='UTF-8'`
in the `tostring` function when converting the etree to a bytes.
opw-3144519
closes odoo/odoo#125223
Signed-off-by: Laurent Smet <las@odoo.com>
Showing
- addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py 1 addition, 2 deletions...account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py
- addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py 1 addition, 2 deletionsaddons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py
- addons/account_edi_ubl_cii/models/ir_actions_report.py 1 addition, 1 deletionaddons/account_edi_ubl_cii/models/ir_actions_report.py
Loading