Before this commit, when an attachment was present in the xml (pdf) and the import was to create a new invoice, it crashed when trying to post the pdf on the not-yet existant invoice. This commit also fixes: - In the tests, `create_invoice_from_file` didn't handle the subfolder parameter correctly - `create_invoice_from_file` now returns the created invoice closes odoo/odoo#69722 X-original-commit: e81457501f4815a4d9add7a56a9dfe66a7656269 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>