Commit 53518447 by 夏超

[fix] 工艺设计

parent cec53239
...@@ -26,7 +26,7 @@ class InheritProductionTask(models.Model): ...@@ -26,7 +26,7 @@ class InheritProductionTask(models.Model):
('sub', '子任务') ('sub', '子任务')
], string='任务类型', compute='_compute_task_type', store=True) ], string='任务类型', compute='_compute_task_type', store=True)
main_task_code = fields.Char(string='主任务编号', compute='_compute_main_task_code', index=True, store=True) main_task_code = fields.Char(string='主任务编号', compute='_compute_task_type', index=True, store=True)
flowing_water = fields.Char(string="物料流水") flowing_water = fields.Char(string="物料流水")
...@@ -132,26 +132,24 @@ class InheritProductionTask(models.Model): ...@@ -132,26 +132,24 @@ class InheritProductionTask(models.Model):
if not self.routing_id: if not self.routing_id:
routing_id = self.env["roke.routing"].create({ routing_id = self.env["roke.routing"].create({
"name": f"{self.product_id.name}({self.code})" or "", "name": f"{self.product_id.name}({self.code})" or "",
"routing_task_id": self.id "state": "确认"
})
self.write({
"routing_id": routing_id.id,
}) })
self.write({"routing_id": routing_id.id})
self.product_id.write({"routing_id": routing_id.id})
self.write({ self.write({
"work_order_ids": self.change_routing_id_work_order(routing_id) "work_order_ids": self.change_routing_id_work_order(routing_id)
}) })
elif not self.routing_id.routing_task_id or self.routing_id.routing_task_id.id != self.id: else:
routing_id = self.routing_id.copy() routing_id = self.routing_id.copy()
routing_id.update({ routing_id.update({
"name": f"{routing_id.name}({self.code})", "name": f"{routing_id.name}({self.code})",
"routing_task_id": self.id "state": "确认"
}) })
self.write({"routing_id": routing_id.id}) self.write({"routing_id": routing_id.id})
self.product_id.write({"routing_id": routing_id.id})
self.write({ self.write({
"work_order_ids": self.change_routing_id_work_order(routing_id) "work_order_ids": self.change_routing_id_work_order(routing_id)
}) })
else:
routing_id = self.routing_id
return { return {
"name": f"工艺设计({self.code})", "name": f"工艺设计({self.code})",
"type": "ir.actions.client", "type": "ir.actions.client",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment