refactor: replace SQL unique constraint with odoo.models.Constraint for hr_employee pin

This commit is contained in:
Suherdy Yacob 2026-06-19 09:43:42 +07:00
parent 406f353b98
commit 6f045a2409

View File

@ -10,13 +10,10 @@ _logger = logging.getLogger(__name__)
class HrEmployee(models.Model):
_inherit = 'hr.employee'
_sql_constraints = [
(
'pin_unique',
'UNIQUE(pin)',
_pin_unique = models.Constraint(
'unique(pin)',
'The Employee PIN Code must be unique across all employees and companies.',
)
]
# ------------------------------------------------------------------
# Helpers