ERPNext app to comply with Mexican Rules and Regulations
ERPNext Mexico Compliance has been designed to adapt ERPNext business logic to comply with the Rules and Regulations of Mexican authorities.
It is built on top of ERPNext and Frappe Framework
For more details see the documentation
The installation steps assumes you have Frappe Framework and ERPNext already installed.
Signup with Frappe Cloud and refer to the Installing an app documentation
# Download app
bench get-app https://github.com/TI-Sin-Problemas/erpnext_mexico_compliance.git --branch version-15
# Install app
bench --site site_name install-app erpnext_mexico_complianceTo enable the CFDI Stamping feature, you will need:
- A package of stamps. To buy a package of stamps please contact us by sending an email to info@tisinproblemas.com
- An API Key and API Secret. You will get your API Key and API Secret whith your package of stamps.
- A valid Digital Signing Certificate (CSD) issued by the Mexican Tax Administration Service (SAT)
Once you have all the requirements, on your ERPNext instance follow the steps below:
-
Go to Desktop -> Mexico Compliance -> Digital Signing Certificate
-
Add a Digital Signing Certificate:
- Click on Add Digital Signing Certificate
- Select your Company
- Attach your certificate file (.cer)
- Attach your certificate key file (.key)
- Enter the Certificate key password
- Click on Save
-
Go to Desktop -> Mexico Compliance -> CFDI Stamping Settings:
- Enter your API Key & API Secret
- Uncheck the Test mode checkbox in your production environment
- Click on Save
You can check the total amount of available credits/stamps in the CFDI Stamping Settings by clicking on the Available Credits button
The CFDI Stamping feature allows you to create and stamp CFDI documents for Sales Invoices and Payment Entries as required by Mexican authorities.
Please be aware that in order to successfully stamp a Sales Invoices, some requirements must be met.
- There must be at least 1 Digital Signing Certificate for the Company issuing the Sales Invoice
- You must have available credits/stamps
- The Address of the Company must have a Zip Code
- The Customer must have a valid Tax Id (RFC)
- The Customer must have a Tax Regime
- The Customer's address must have a Zip Code
- The Invoice Items must have a SAT Product or Service Key
- The UOM of the Invoice Items must have a SAT UOM Key
- The Mode of Payment of the invoice must have a SAT Payment Method
- The invoice must have a SAT Payment Option
To stamp a Sales Invoice, a Stamp CFDI button will be available on the Sales Invoice form once it has being submitted.
Please be aware that in order to successfully stamp a Payment Entry, some requirements must be met.
- There must be at least 1 Digital Signing Certificate for the Company issuing the Payment Entry
- You must have available credits/stamps
- The Address of the Company must have a Zip Code
- All the Reference Items must have being stamped
Some of the Mexican authorities catalogs are added as Doctypes
| Doctype | Catalog (in spanish) |
|---|---|
| Cancellation reason | Motivo de cancelación SAT |
| SAT CFDI Use | Uso de CFDI SAT |
| SAT Payment Method | Forma de pago SAT |
| SAT Payment Option | Método de pago SAT |
| SAT Product Or Service Key | Clave de producto/servicio SAT |
| SAT Tax Regime | Régimen fiscal SAT |
| SAT UOM Key | Clave de unidad de medida SAT |
New fields are created for the following Doctypes
| Field | Description |
|---|---|
| Tax Type | Type of Tax for Tax Accounts (IVA, ISR, IEPS) |
| Field | Description |
|---|---|
| CLABE | CLABE (Clave Bancaria Estandarizada) for Bank Accounts |
| Field | Description |
|---|---|
| SAT Tax Regime | SAT Tax Regime for Companies |
| Field | Description |
|---|---|
| SAT Tax Regime | SAT Tax Regime for Customers |
| CFDI Use | Default CFDI Use for Customer's Invoices |
| Addenda | Includes custom content into the XML's Addenda section of Customer's CFDI Invoices |
| Field | Description |
|---|---|
| SAT Product or Service Key | SAT Product or Service Key for Items |
| Field | Description |
|---|---|
| SAT Payment Method | Used to Link Invoices & Payment Entries with SAT Payment Method |
| Field | Description |
|---|---|
| Cancellation reason | If a stamped Payment Entry needs to be cancelled, a Cancellation Reason must be provided |
| Substitute payment entry | If the Cancellation Reason requires it, this field allows to specify a Substitute payment entry |
| Stamped XML | Holds the XML data generated by the CFDI Stamping process. |
| Cancellation acknowledgement | Cancellation Acknowledgement XML data generated by the CFDI Cancellation Stamping process. |
| Field | Description |
|---|---|
| Mode of Payment | Mode of Payment for Sales Invoices |
| SAT Payment Option | SAT Payment Option for Sales Invoices |
| SAT CFDI Use | SAT CFDI Use for Sales Invoices |
| SAT Payment Method | SAT Payment Method for Sales Invoices |
| Stamped XML | Holds the XML data generated by the CFDI Stamping process. |
| Cancellation reason | If a stamped Sales Invoice needs to be cancelled, a Cancellation Reason must be provided |
| Substitute invoice | If the Cancellation Reason requires it, this field allows to specify a Substitute invoice |
| Cancellation acknowledgement | Cancellation Acknowledgement XML data generated by the CFDI Cancellation Stamping process. |
| Addenda | Includes custom content into the XML's Addenda section of the CFDI Invoices |
| Field | Description |
|---|---|
| SAT Product or Service Key | SAT Product or Service Key for Sales Invoice Items |
| Field | Description |
|---|---|
| SAT Product or Service Key | SAT Product or Service Key for Sales Order Items |
| Field | Description |
|---|---|
| Mode of Payment | Mode of Payment for Sales Invoices |
| SAT Payment Option | SAT Payment Option for Sales Invoices |
| Field | Description |
|---|---|
| SAT UOM Key | Used to link Sales Invoice Items with a SAT UOM Key |
The following Document Event hooks are implemented
| Hook | Description |
|---|---|
before_stamp_cfdi |
Method executed before stamping a CFDI document |
after_stamp_cfdi |
Method executed after stamping a CFDI document |
before_attach_files |
Method executed before attaching the CFDI files to the document |
after_attach_files |
Method executed after attaching the CFDI files to the document |
before_attach_pdf |
Method executed before attaching the PDF file to the document |
after_attach_pdf |
Method executed after attaching the PDF file to the document |
before_attach_xml |
Method executed before attaching the XML file to the document |
after_attach_xml |
Method executed after attaching the XML file to the document |
The following Scheduled Jobs are implemented
| Scheduled Job Type | Description | Frequency |
|---|---|---|
check_cancellation_status |
Checks the CFDI cancellation status of Sales Invoices and Payment Entries | Hourly |
PRs are welcome!
If you want to help with the translation of this app, please consider joining the project on Crowdin
MIT