删除接口调用
This commit is contained in:
@@ -285,19 +285,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if self.state == 'waiting' or self.state == 'ready':
|
if self.state == 'waiting' or self.state == 'ready':
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|
||||||
if self.routing_type == '获取CNC加工程序':
|
|
||||||
json = {
|
|
||||||
'params': {
|
|
||||||
'model_name': 'jikimo.process.order',
|
|
||||||
'field_name': 'name',
|
|
||||||
'default_code': 'PO-2022-1123-0014',
|
|
||||||
'state': '加工中',
|
|
||||||
'date_start': datetime.now(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
url = 'https://bfm.cs.jikimo.com/api/get/state'
|
|
||||||
requests.post(url, json=json, data=None)
|
|
||||||
|
|
||||||
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
|
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
|
||||||
return True
|
return True
|
||||||
# As button_start is automatically called in the new view
|
# As button_start is automatically called in the new view
|
||||||
@@ -343,41 +330,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise ValidationError(_('请先完成上一步工单'))
|
raise ValidationError(_('请先完成上一步工单'))
|
||||||
|
|
||||||
# 重写完成按钮
|
|
||||||
def button_finish(self):
|
|
||||||
end_date = datetime.now()
|
|
||||||
|
|
||||||
if self.routing_type == '解除装夹':
|
|
||||||
json = {
|
|
||||||
'params': {
|
|
||||||
'model_name': 'jikimo.process.order',
|
|
||||||
'field_name': 'name',
|
|
||||||
'default_code': 'PO-2022-1123-0014',
|
|
||||||
'state': '加工中',
|
|
||||||
'date_finishi': datetime.now(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
url = 'https://bfm.cs.jikimo.com/api/get/state'
|
|
||||||
requests.post(url, json=json, data=None)
|
|
||||||
|
|
||||||
for workorder in self:
|
|
||||||
if workorder.state in ('done', 'cancel'):
|
|
||||||
continue
|
|
||||||
workorder.end_all()
|
|
||||||
vals = {
|
|
||||||
'qty_produced': workorder.qty_produced or workorder.qty_producing or workorder.qty_production,
|
|
||||||
'state': 'done',
|
|
||||||
'date_finished': end_date,
|
|
||||||
'date_planned_finished': end_date,
|
|
||||||
'costs_hour': workorder.workcenter_id.costs_hour
|
|
||||||
}
|
|
||||||
if not workorder.date_start:
|
|
||||||
vals['date_start'] = end_date
|
|
||||||
if not workorder.date_planned_start or end_date < workorder.date_planned_start:
|
|
||||||
vals['date_planned_start'] = end_date
|
|
||||||
workorder.write(vals)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class CNCprocessing(models.Model):
|
class CNCprocessing(models.Model):
|
||||||
_name = 'sf.cnc.processing'
|
_name = 'sf.cnc.processing'
|
||||||
|
|||||||
Reference in New Issue
Block a user