对于测试用例进行修改

This commit is contained in:
胡尧
2024-09-10 17:49:52 +08:00
parent 8945801db8
commit d000aa095f
2 changed files with 18 additions and 19 deletions

View File

@@ -18,8 +18,8 @@
<field name="workcenter_id" options="{'no_create': True}"/> <field name="workcenter_id" options="{'no_create': True}"/>
</group> </group>
<footer> <footer>
<button string="确认配送" name="dispatch_confirm" type="object" class="oe_highlight o_wizard_confirm_button jikimo_button_confirm" attrs="{'invisible': [('confirm_button', '!=', '确认配送')]}"/> <button string="确认配送" name="confirm" type="object" class="oe_highlight o_wizard_confirm_button jikimo_button_confirm" attrs="{'invisible': [('confirm_button', '!=', '确认配送')]}"/>
<button string="确认解除" name="dispatch_confirm" type="object" class="oe_highlight o_wizard_confirm_button jikimo_button_confirm" attrs="{'invisible': [('confirm_button', '!=', '确认解除')]}"/> <button string="确认解除" name="confirm" type="object" class="oe_highlight o_wizard_confirm_button jikimo_button_confirm" attrs="{'invisible': [('confirm_button', '!=', '确认解除')]}"/>
<button string="取消" class="btn btn-secondary" special="cancel"/> <button string="取消" class="btn btn-secondary" special="cancel"/>
</footer> </footer>
</sheet> </sheet>

View File

@@ -87,21 +87,9 @@ class WorkpieceDeliveryWizard(models.TransientModel):
} }
def confirm(self): def confirm(self):
try: try:
# if self.workorder_id: if not self.workorder_ids:
# self.workorder_id.workpiece_delivery_ids[0].agv_scheduling_id() raise UserError('制造订单不能为空')
# else:
# is_not_production_line = 0
# same_production_line_id = None
# notsame_production_line_arr = []
# for item in self.production_ids:
# if same_production_line_id is None:
# same_production_line_id = item.production_line_id.id
# if item.production_line_id.id != same_production_line_id:
# notsame_production_line_arr.append(item.name)
# notsame_production_line_str = ','.join(map(str, notsame_production_line_arr))
# if is_not_production_line >= 1:
# raise UserError('制造订单号为%s的目的生产线不一致' % notsame_production_line_str)
# else:
scheduling = self.env['sf.agv.scheduling'].add_scheduling( scheduling = self.env['sf.agv.scheduling'].add_scheduling(
agv_start_site_name=self.feeder_station_start_id.name, agv_start_site_name=self.feeder_station_start_id.name,
agv_route_type=self.delivery_type, agv_route_type=self.delivery_type,
@@ -129,7 +117,18 @@ class WorkpieceDeliveryWizard(models.TransientModel):
item.button_start() item.button_start()
item.button_finish() item.button_finish()
return scheduling.read()[0] # return scheduling.read()[0]
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'target': 'new',
'params': {
'message': '任务下发成功AGV任务调度编号为【%s' % scheduling.name,
'type': 'success',
'sticky': False,
'next': {'type': 'ir.actions.act_window_close'},
}
}
except Exception as e: except Exception as e:
logging.info('%s任务下发失败:%s' % (self.delivery_type, e)) logging.info('%s任务下发失败:%s' % (self.delivery_type, e))
raise UserError('%s任务下发失败:%s' % (self.delivery_type, e)) raise UserError('%s任务下发失败:%s' % (self.delivery_type, e))
@@ -189,7 +188,7 @@ class WorkpieceDeliveryWizard(models.TransientModel):
self.feeder_station_start_id = agv_site.id self.feeder_station_start_id = agv_site.id
else: else:
if self.feeder_station_start_id.id != agv_site.id: if self.feeder_station_start_id.id != agv_site.id:
raise UserError('接驳站不匹配!') raise UserError('起点接驳站不匹配!')
return return
delivery_type = self.env.context.get('default_delivery_type') delivery_type = self.env.context.get('default_delivery_type')
if delivery_type == '上产线': if delivery_type == '上产线':