[FW][FIX] l10n_es_edi_facturae: enable the feature for B2B only
To reproduce the issue: (Need website_sale)
- Set up a website shop for ES company
- With demo payment method
- In Settings:
- Website > Automatic Invoice: enabled
- With a portal user, add a product to the cart
- Open the cart
- Pay with Demo
Error: The client is redirected to a page "Internal server error: The partner needs a set tax identification number or VAT number"
When post-processing the payment, and because of step 2, it leads to https://github.com/odoo/odoo/blob/20365bcab548c4a2d93194c8c2b8b2577d14d3ce/addons/l10n_es_edi_facturae/wizard/account_move_send.py#L86-L88 Where we will generate the data for the Facturae XML. There, we check few things, like the vat number of the partner: https://github.com/odoo/odoo/blob/e157cb2d8640fac1365beb135763cb25cff554f5/addons/l10n_es_edi_facturae/models/account_move.py#L312-L313 And since the portal user does not have any vat number, the error is raised.
The Facturae feature should only be enabled for B2B flows
OPW-4121724
Forward-Port-Of: odoo/odoo#181653
This PR targets saas-17.2 and is part of the forward-port chain. Further PRs will be created up to master.
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
