code change · fixIntegration & APIsofficial - Microsoftreviewed - checked by Opus

#9697 Features/494919 master mx cfdi rounding e invoice docs

Mexican CFDI stamp requests now recalculate SubTotal as the sum of line amounts rounded to 6 decimals, excluding retention lines, and recompute Total to match. Before calling the PAC, rounding models are checked locally against per-line tax amounts. Other models are tried only if the PAC rejects the document with a rounding error.

Pull request · merged into main (BC30) on 2026-08-05 by v-mjofre · 3 files (+561 -59), 1 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • SubTotal is recalculated as the sum of individually rounded line amounts to comply with CFDI40108 requirements
  • Total is recomputed after SubTotal adjustment to maintain consistency with CFDI40119 standards
  • A new local rounding model pre-validation process identifies the correct rounding approach before sending documents to the PAC
  • Fallback mechanism now intelligently selects alternative rounding models only when PAC rejects with rounding-specific errors
  • Retention lines are properly excluded from SubTotal calculations and comprehensive tests prevent future regressions
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#638201
  • Labels: Team: Integrations
  • Systems: integration
  • From the description: “The generated CFDI XML produced rounding mismatches in SubTotal and per-line tax amounts, causing PAC validation errors.”

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).