From 2894b6c5a75885c512a5a23290b453c7f04e0da2 Mon Sep 17 00:00:00 2001 From: Simon Maillard Date: Wed, 26 Jun 2024 12:19:23 +0200 Subject: [PATCH] [MIG] hr_employee_id: Migration to 16.0 --- hr_employee_id/models/hr_employee.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hr_employee_id/models/hr_employee.py b/hr_employee_id/models/hr_employee.py index d72e72481875..6faa5e7a3477 100644 --- a/hr_employee_id/models/hr_employee.py +++ b/hr_employee_id/models/hr_employee.py @@ -59,7 +59,11 @@ def _generate_identification_id(self): ) @api.model - def create(self, vals): - if not vals.get("identification_id"): - vals["identification_id"] = self._generate_identification_id() - return super(HrEmployee, self).create(vals) + def create(self, vals_list): + records = super(HrEmployee, self).create(vals_list) + + for record in records: + if not record.identification_id: + record.identification_id = record._generate_identification_id() + + return records