审批流中回写生效时间小于今天的,定时任务回写生效时间等于今天的。
定时任务代码如下:
today=datetime.date.today()
approve_recs = env['x_builder_intern2probation'].search([('active','=',True),('x_effectivedate','=',today),('x_bp_state','=','done')])
for approve_rec in approve_recs:
if approve_rec.x_effectivedate==today:
emp_job = approve_rec.x_employeeid.job_info_id
emp_dic =
{
'x_probationstartdate': approve_rec.x_intern2probationdate,
}
job_dic =
{
'employee_type': approve_rec.x_employeetype.id,
'employee_group': approve_rec.x_employeegroup.id,
}
approve_rec.x_employeeid.update(emp_dic)
emp_job.update(job_dic)
审批流动作代码如下:
today=datetime.date.today()
if today > self.x_effectivedate:
emp_job = self.x_employeeid.job_info_id
emp_dic =
{
'x_probationstartdate': self.x_intern2probationdate,
}
job_dic =
{
'employee_type': self.x_employeetype.id,
'employee_group': self.x_employeegroup.id,
}
self.x_employeeid.update(emp_dic)
emp_job.update(job_dic)