1.4 KiB
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
- Copy hr_employee_pin into your custom addons path.
- Update the addons list in Odoo.
- Install Employee PIN Generator.
Usage
To regenerate the PIN:
- Open an employee record.
- Go to the Settings tab under the Attendance/Point of Sale section.
- Click the Regenerate PIN button inline with the PIN Code field.
- Confirm in the dialog.
Author
Suherdy Yacob
License
LGPL-3