-
Change
-
解决结果: 完成
-
High
-
无
-
无
-
Y-易路产品-
-
基础通用功能
需要将员工管理中,字段编码:x_employee_id,字段名称:员工号,该字段写一段编码生成规则code,生成规则为每次新增时需要判断目前系统中存在的最大值,进行加1,且个位数逢4跳过。
for record in self:
employees = record.env['hr.employee'].search_read([],fields=['x_employee_id'])
x_employee_id_list = [employee['x_employee_id'] for employee in employees]
next_id = int(max(x_employee_id_list)) + 1
if str(next_id)[-1] == 4:
next_id += 1
record['x_employee_id'] = next_id
是否这样写就行?