Hi Alexis,
We (Alusage) now need the einvoicing stack on Odoo 15.0 for a customer, so we started a backport — this time from our 16.0 branch, not from 18.0.
As for 16.0 (#28) and 19.0 (#35), there is no 15.0 branch on this repo — would you be willing to create one? We'd then submit a proper PR against it. Everything is public in the meantime:
https://github.com/Alusage/fr-einvoicing/tree/MIG-15.0-account_invoice_en16931 (branched off MIG-16.0-account_invoice_en16931)
This is WIP: nothing is installed or tested on a 15.0 database yet. Opening early so you can tell us if any of it is a bad idea.
The good news: 16.0 → 15.0 is a much smaller step than 18.0 → 16.0
The hard part of the 16.0 backport — rewriting the tax layer of the 18.0 generic tax engine on top of compute_all() — carries over unchanged. compute_all() has the same signature on 15.0 (only the 16.0 fixed_multiplicator kwarg is missing, and the module never passes it). Same for the other three 18.0→16.0 chores:
_("txt") % arg — GettextAlias.__call__(source, *args, **kwargs) is byte-for-byte identical on 15.0 and 16.0, so the rewritten calls stay as they are.
- View syntax (
attrs=, <tree>, o_setting_box) — unchanged on 15.0.
- PDF/A-3:
OdooPdfFileWriter.convert_to_pdfa() already exists on 15.0, in the same shape, so _en16931_pdf_to_pdfa() needs no change at all. That one was a nice surprise.
There is no JS in the stack, so the OWL 1 / OWL 2 split does not come into play.
What actually has to be rewritten: the report layer
ir.actions.report was reworked in 16.0 (per-record streams). On 15.0 none of these exist:
_render_qweb_pdf_prepare_streams(report_ref, data, res_ids) — the hook account_invoice_en16931/models/ir_actions_report.py overrides;
_get_report(report_ref) (base) and _is_invoice_report(report_ref) (account);
- the
report_ref first argument of _render() / _render_qweb_pdf().
15.0 renders the whole PDF in one go, so the Factur-X injection has to move to _post_pdf(save_in_attachment, pdf_content, res_ids) — which is exactly what your own account_invoice_facturx does on OCA/edi 15.0, so we'll follow that. _get_pdf_invoice_bin() becomes report._render([self.id]) on the report recordset.
Two OCA prerequisites are missing on 15.0
Both landed upstream on 16.0 while the 16.0 backport was running; on 15.0 they are simply not there. We backported them and will submit them to OCA:
- VATEX codes on
account_tax_unece (data/unece_tax_vatex.xml, unece_vatex_id, _compute_unece_vatex_id) — https://github.com/Alusage/community-data-files/tree/15.0-add-unece-vatex (your two 16.0 commits cherry-picked, migration renamed to 15.0.2.0.0, tree view re-anchored on the 15.0 field).
l10n_fr_siret helpers (is_france_country, _get_siren(), _get_siret(), _get_nic(), VAT↔SIREN consistency check) — https://github.com/Alusage/l10n-france/tree/15.0-siret-get-methods (your commit 9e662b1a + the self.env._ follow-up). The partner view keeps its 15.0 layout, since l10n_fr_siret still defines company_registry itself on that version.
Two modules left out for now
l10n_fr_einvoicing_dashboard_banner — account_dashboard_banner only exists on 16.0 (OCA/account-financial-tools). Left installable: False.
l10n_fr_einvoicing_import — account_invoice_import was never migrated to 15.0: OCA/edi has it on 14.0 and 16.0, nothing in between, and base_business_document_import is missing too. We intend to migrate both from 16.0 (they contain no 16.0-only API as far as we can tell) and submit them to OCA/edi, but that is a separate piece of work.
The other eight modules are in scope.
Anything you'd rather we did differently, tell us early — happy to adjust.
Hi Alexis,
We (Alusage) now need the einvoicing stack on Odoo 15.0 for a customer, so we started a backport — this time from our 16.0 branch, not from
18.0.As for 16.0 (#28) and 19.0 (#35), there is no
15.0branch on this repo — would you be willing to create one? We'd then submit a proper PR against it. Everything is public in the meantime:https://github.com/Alusage/fr-einvoicing/tree/MIG-15.0-account_invoice_en16931 (branched off
MIG-16.0-account_invoice_en16931)This is WIP: nothing is installed or tested on a 15.0 database yet. Opening early so you can tell us if any of it is a bad idea.
The good news: 16.0 → 15.0 is a much smaller step than 18.0 → 16.0
The hard part of the 16.0 backport — rewriting the tax layer of the 18.0 generic tax engine on top of
compute_all()— carries over unchanged.compute_all()has the same signature on 15.0 (only the 16.0fixed_multiplicatorkwarg is missing, and the module never passes it). Same for the other three 18.0→16.0 chores:_("txt") % arg—GettextAlias.__call__(source, *args, **kwargs)is byte-for-byte identical on 15.0 and 16.0, so the rewritten calls stay as they are.attrs=,<tree>,o_setting_box) — unchanged on 15.0.OdooPdfFileWriter.convert_to_pdfa()already exists on 15.0, in the same shape, so_en16931_pdf_to_pdfa()needs no change at all. That one was a nice surprise.There is no JS in the stack, so the OWL 1 / OWL 2 split does not come into play.
What actually has to be rewritten: the report layer
ir.actions.reportwas reworked in 16.0 (per-record streams). On 15.0 none of these exist:_render_qweb_pdf_prepare_streams(report_ref, data, res_ids)— the hookaccount_invoice_en16931/models/ir_actions_report.pyoverrides;_get_report(report_ref)(base) and_is_invoice_report(report_ref)(account);report_reffirst argument of_render()/_render_qweb_pdf().15.0 renders the whole PDF in one go, so the Factur-X injection has to move to
_post_pdf(save_in_attachment, pdf_content, res_ids)— which is exactly what your ownaccount_invoice_facturxdoes on OCA/edi 15.0, so we'll follow that._get_pdf_invoice_bin()becomesreport._render([self.id])on the report recordset.Two OCA prerequisites are missing on 15.0
Both landed upstream on 16.0 while the 16.0 backport was running; on 15.0 they are simply not there. We backported them and will submit them to OCA:
account_tax_unece(data/unece_tax_vatex.xml,unece_vatex_id,_compute_unece_vatex_id) — https://github.com/Alusage/community-data-files/tree/15.0-add-unece-vatex (your two 16.0 commits cherry-picked, migration renamed to15.0.2.0.0, tree view re-anchored on the 15.0 field).l10n_fr_sirethelpers (is_france_country,_get_siren(),_get_siret(),_get_nic(), VAT↔SIREN consistency check) — https://github.com/Alusage/l10n-france/tree/15.0-siret-get-methods (your commit9e662b1a+ theself.env._follow-up). The partner view keeps its 15.0 layout, sincel10n_fr_siretstill definescompany_registryitself on that version.Two modules left out for now
l10n_fr_einvoicing_dashboard_banner—account_dashboard_banneronly exists on 16.0 (OCA/account-financial-tools). Leftinstallable: False.l10n_fr_einvoicing_import—account_invoice_importwas never migrated to 15.0: OCA/edi has it on 14.0 and 16.0, nothing in between, andbase_business_document_importis missing too. We intend to migrate both from 16.0 (they contain no 16.0-only API as far as we can tell) and submit them to OCA/edi, but that is a separate piece of work.The other eight modules are in scope.
Anything you'd rather we did differently, tell us early — happy to adjust.