修改需求计划,下达生成的方法

This commit is contained in:
胡尧
2025-06-20 14:51:58 +08:00
parent 788183e239
commit b33c992b25
6 changed files with 49 additions and 10 deletions

View File

@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['sf_plan', 'jikimo_printing'],
'depends': ['sf_plan'],
'data': [
'security/ir.model.access.csv',
'views/demand_plan.xml',

View File

@@ -323,15 +323,12 @@ 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
batch_size = 28
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()
self._do_production_schedule(pro_plan_list)
def _do_production_schedule(self, pro_plan_list):
for pro_plan in pro_plan_list:
pro_plan.do_production_schedule()
def button_action_print(self):
return {