odoo/enterprise#82039

Created by fw-bot
Merged at 201f29869480c27ea7e38495eea98960ac70eebe

Statuses:

Linked pull requests
label
odoo-dev:master-18.0-l10n-br-edi-pos-task-3564171-jov-424262-fw
head
26ee2754cebd1fb899da7747df3048e5db3d0e44
merged
7 months ago by Misc, Joren Van Onder (jov)
odoo/odoo odoo/enterprise
18.0 #193834 #77206
saas-18.1 #201790 #81469
saas-18.2 #202616 #81796
saas-18.3
saas-18.4
19.0
master #203199 #82039

[FW][ADD] l10n_br_edi_pos: Brazilian EDI in the POS with Avatax

This module implements issueing NFC-e receipts through the POS. The process is conceptually similar to what we do for invoices. First taxes are calculated, and then we e-invoice.

The calculated taxes will never change the order total. NFC-e mandates taxes to always be included in the price so we don't need any additional RPC call before payment.

One way of achieving this was through l10n_br_edi, forcing every pos.order to be invoiced and then following the implemented flows on account.move. We decided against it because:

  • It leads to a large amount of mostly unnecessary invoices,
  • It's conceptually strange to the user, NFC-e "invoices" resemble POS receipts more than they do invoices,
  • The flow in the POS is simpler, we handle tax calculation and EDI in one atomic step.

We therefore chose to re-implement EDI for pos.order. The downside of this approach is that we temporarily need to copy some code from l10n_br_edi. In master this code can be consolidated in a common mixin.

The integration tries to never block POS sales. You're allowed to retry EDI later. When EDI fails, the POS user is informed and we fall back to the standard receipt (marked as a "receipt without fiscal value").

For refunds we still go through account.move, as NFC-e doesn't support refunds (must be NF-e, which is what we already support for account.move).

task-3564171

Forward-Port-Of: #81796
Forward-Port-Of: #77206