ERPNext Mexico Compliance is a Frappe application built on top of ERPNext that adapts your ERP instance to meet the rules and regulations of Mexican fiscal authorities, specifically the Servicio de Administración Tributaria (SAT). It is intended for Mexican businesses and ERPNext implementers who need to issue legally valid electronic invoices (CFDI 4.0) directly from ERPNext, without maintaining a separate billing system. The app bridges the gap between standard ERPNext business logic and the Mexican tax framework by adding compliance fields, SAT catalog DocTypes, a web service client to the TI Sin Problemas stamping service, and event hooks for custom integrations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TI-Sin-Problemas/erpnext_mexico_compliance/llms.txt
Use this file to discover all available pages before exploring further.
How it works
ERPNext Mexico Compliance operates entirely within the Frappe framework. It does not replace ERPNext’s core accounting logic — instead, it extends it through a set of focused overrides and additions:-
DocType overrides — The app overrides the
Customer,Employee,Payment Entry,Sales Invoice, andSales Invoice ItemDocType classes to inject Mexican compliance behavior. Custom fields (RFC, SAT Tax Regime, SAT Payment Method, Stamped XML, etc.) are added to these and several other DocTypes via Frappe’s fixture mechanism, so the fields survive upgrades cleanly. -
Stamping service client — When a Sales Invoice or Payment Entry is ready to be stamped, the app serializes the document data into a CFDI 4.0 XML structure using the
satcfdilibrary and sends it to the TI Sin Problemas web service for fiscal sealing (timbrado). The signed XML (with SAT UUID, digital seal, and QR code) is stored back on the originating document. - SAT catalog sync — Mexican SAT publishes official catalogs for payment methods, tax regimes, product/service keys, and units of measure. ERPNext Mexico Compliance ships these catalogs as Frappe DocTypes and populates them during installation, so all SAT-required codes are available as linked fields across your master data.
- Scheduled background job — A Frappe scheduler event runs every hour to poll the SAT cancellation status of any pending Sales Invoice or Payment Entry CFDI cancellation requests, keeping document state current without manual intervention.
Key capabilities
CFDI 4.0 Stamping
Generate and stamp CFDI 4.0 electronic invoices for Sales Invoices and Payment Entries directly from ERPNext. A Stamp CFDI button appears on submitted documents, or stamping can be triggered automatically on submission. The signed XML and cancellation acknowledgement are stored on the document.
CFDI Cancellation
Cancel stamped CFDI documents in compliance with SAT requirements. Cancellation reasons and optional substitute document links are captured on Sales Invoices and Payment Entries. The hourly
check_cancellation_status scheduled job tracks SAT acceptance of cancellation requests automatically.SAT Catalogs
Ships all required SAT reference catalogs as native Frappe DocTypes: SAT CFDI Use, SAT Payment Method, SAT Payment Option, SAT Product or Service Key, SAT Tax Regime, SAT UOM Key, and Cancellation Reason. These are linked directly to master data records (Customers, Items, UOMs, Modes of Payment) so lookups are validated at every step.
Compliance Fields
Adds Mexican compliance fields to standard ERPNext DocTypes including Account (Tax Type), Bank Account (CLABE), Company (SAT Tax Regime), Customer (SAT Tax Regime, CFDI Use, Addenda), Item (SAT Product or Service Key), Mode of Payment (SAT Payment Method), UOM (SAT UOM Key), Sales Invoice, Sales Invoice Item, Sales Order Item, Payment Entry, and Subscription.
Extensibility Hooks
Exposes two document event hooks —
before_stamp_cfdi and after_stamp_cfdi — allowing developers to inject custom logic immediately before and after the CFDI stamping process. Use these hooks to populate custom Addenda XML sections, trigger third-party integrations, or enforce business rules specific to your deployment.Scheduled Jobs
Registers a Frappe hourly scheduler event (
check_cancellation_status) that automatically polls the stamping service for the SAT cancellation status of Sales Invoices and Payment Entries that have an in-progress cancellation request. No manual polling or cron configuration required.Requirements
Before installing ERPNext Mexico Compliance, ensure your environment meets the following prerequisites:| Requirement | Version |
|---|---|
| Frappe Framework | >=16.0.0, <17.0.0 |
| ERPNext | >=16.0.0, <17.0.0 |
| Python | >=3.14 |
satcfdi (Python package) | ==4.9.25 |
lxml (Python package) | ==6.1.1 |
| TI Sin Problemas stamp credits | Active package required |
satcfdi and lxml Python packages are declared as dependencies in pyproject.toml and are installed automatically by Frappe Bench when the app is added. Stamp credits must be purchased separately from TI Sin Problemas — contact [email protected] to obtain a package and your API credentials.