Rut Chileno

Custom Field for Chilieand DNI as RUT in ERPNext

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:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=joil%2Frut_chileno)](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-5
  • 12345678-5
  • 123456785
  • 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:

  1. Crea o actualiza el campo RUT en Employee.
  2. Relabela tax_id como RUT en Customer, Supplier y Company.
  3. Migra datos del Custom Field rut antiguo hacia tax_id.
  4. 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.