计划增加队列
This commit is contained in:
@@ -323,8 +323,15 @@ class SfProductionDemandPlan(models.Model):
|
||||
date_planned_start = datetime.combine(date_part, time_part)
|
||||
pro_plan_list.production_line_id = sf_production_line.id
|
||||
pro_plan_list.date_planned_start = date_planned_start
|
||||
for pro_plan in pro_plan_list:
|
||||
pro_plan.do_production_schedule()
|
||||
batch_size = 100
|
||||
for i in range(0, len(pro_plan_list), batch_size):
|
||||
current_time = fields.Datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
batch = self.env['queue.job.batch'].get_new_batch('plan-%s-%s' % (current_time, i))
|
||||
pro_plans = pro_plan_list[i:i+batch_size]
|
||||
pro_plans.with_context(
|
||||
job_batch=batch
|
||||
).with_delay().do_production_schedule()
|
||||
batch.enqueue()
|
||||
|
||||
def button_action_print(self):
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user