hr_employee_pin/README.md

1.4 KiB

Employee PIN Generator

This Odoo 19 module automatically assigns a unique, randomly generated 6-digit PIN to every employee record using Odoo's standard PIN Code field. The PIN is enforced to be globally unique across all companies in the database via a SQL UNIQUE constraint.

Features

  • Auto-generates a unique 6-digit numeric PIN when a new employee is created.
  • Reuses Odoo's standard PIN Code field (used in Point of Sale and HR Attendance).
  • PIN uniqueness is enforced at the database level across all companies.
  • A Regenerate PIN button is available inline with the PIN Code field on the employee form.
  • A confirmation wizard is shown before replacing the current PIN.

Technical Details

  • Model extended: hr.employee
  • Field modified: pin (Odoo's standard PIN Code)
  • New transient model: hr.employee.regenerate.pin.wizard
  • PIN generation retries up to 1,000 times to avoid collision.

Installation

  1. Copy hr_employee_pin into your custom addons path.
  2. Update the addons list in Odoo.
  3. Install Employee PIN Generator.

Usage

To regenerate the PIN:

  1. Open an employee record.
  2. Go to the Settings tab under the Attendance/Point of Sale section.
  3. Click the Regenerate PIN button inline with the PIN Code field.
  4. Confirm in the dialog.

Author

Suherdy Yacob

License

LGPL-3