Rut Chileno
Custom Field for Chilieand DNI as RUT in ERPNext
- Author: joil
- Repository: https://github.com/joil/rut_chileno
- GitHub stars: 0
- Forks: 0
- License: MIT
- Category: Developer Tools
- Maintenance: Actively Maintained
Install Rut Chileno
bench get-app https://github.com/joil/rut_chileno
Add the Frappe Gems badge to your README
Maintain Rut Chileno? Paste this into your README:
[](https://frappegems.com/gems/apps/joil/rut_chileno)
About Rut Chileno
Rut Chileno
RUT chileno (Rol Único Tributario) para ERPNext v16: valida el formato y el dígito verificador (módulo 11) y lo guarda de forma canónica.
Requiere ERPNext. Compatible con Frappe/ERPNext version-16.
Qué hace
| DocType | Campo | Comportamiento |
|---|---|---|
| Customer | tax_id (nativo, etiqueta RUT) |
Valida, formatea y evita duplicados |
| Supplier | tax_id (nativo, etiqueta RUT) |
Igual |
| Company | tax_id (nativo, etiqueta RUT) |
Igual. Obligatorio si el país es Chile |
| Employee | Custom Field rut |
Valida, formatea y evita duplicados. Opcional |
En Cliente, Proveedor y Compañía no se crea un segundo campo RUT: ERPNext ya tiene tax_id, que usan reportes, impresión y otras apps. Si existía un Custom Field rut de una versión anterior, su valor se copia a tax_id (si este estaba vacío) y el campo extra se elimina.
Formato
Se aceptan estas entradas:
12.345.678-512345678-5123456785- con espacios o ceros a la izquierda
Se guarda siempre como 12.345.678-5 (puntos de miles, guión y K mayúscula).
El dígito verificador se calcula con el algoritmo módulo 11 del SII. Un RUT con DV incorrecto se rechaza y el mensaje indica el dígito esperado.
El RUT no es obligatorio en Cliente, Proveedor ni Empleado (permite terceros extranjeros o fichas incompletas). Si el campo tiene valor, debe ser un RUT chileno válido.
Instalación
cd $PATH_TO_YOUR_BENCH
bench get-app $URL_OF_THIS_REPO --branch version-16
bench --site $SITE install-app rut_chileno
Al instalar (y en cada bench migrate) la app:
- Crea o actualiza el campo RUT en Employee.
- Relabela
tax_idcomo RUT en Customer, Supplier y Company. - Migra datos del Custom Field
rutantiguo haciatax_id. - Reformatea RUT ya guardados al formato canónico (los inválidos se dejan y se registran en el log).
Para desinstalar:
bench --site $SITE uninstall-app rut_chileno
Se elimina el Custom Field de Employee y los Property Setter de tax_id. Los valores de tax_id no se borran.
Impresión (Jinja)
En formatos de impresión:
{{ doc.tax_id }}
{{ doc.tax_id | formatea_rut }}
Contributing
This app uses pre-commit for code formatting and linting. Please install pre-commit and enable it for this repository:
cd apps/rut_chileno
pre-commit install
Pre-commit is configured to use the following tools for checking and formatting your code:
- ruff
- eslint
- prettier
- pyupgrade
License
mit
Related Developer Tools apps for Frappe & ERPNext
- Frappe — Low code web framework for real world applications, in Python and Javascript
- Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
- Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
- Bench — CLI to manage Multi-tenant deployments for Frappe apps
- Frappe Ui — A set of components and utilities for rapid UI development
- Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
- Gameplan — Open Source Discussions Platform for Remote Teams
- Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.