Commit 0c9415d3 by 夏超

[fix] 修改问题

parent 41f6af00
......@@ -13,7 +13,7 @@ class JzjxInheritRepairOrder(models.Model):
class JzjxInheritRepairOrderLine(models.Model):
_inherit = "roke.repair.order.line"
repair_work_order_id = fields.Many2one("roke.work.order", string="返修工单", ondelete='restrict')
repair_work_order_id = fields.Many2one("roke.work.order", string="返修工单")
is_refix_auto_work_order = fields.Boolean(string="是否自动生产返修单")
reason_id = fields.Many2one("roke.scrap.reason", string="报废原因", ondelete='restrict')
......@@ -13,5 +13,5 @@ class JzjxInheritScrapOrder(models.Model):
class JzjxInheritScrapOrderLine(models.Model):
_inherit = "roke.scrap.order.line"
scrap_work_order_ids = fields.Many2many("roke.work.order", string="补件工单", ondelete='restrict')
scrap_work_order_ids = fields.Many2many("roke.work.order", string="补件工单")
is_rfe = fields.Boolean(string="是否工单补件")
......@@ -94,8 +94,7 @@ class InheritWorkOrder(models.Model):
class InheritRokeWorkRecordModel(models.Model):
_inherit = "roke.work.record"
def withdraw_repair_scrap(self):
work_order = self.work_order_id
def withdraw_work_order(self, work_order):
if not work_order.task_id and not work_order.record_ids and work_order.type == "生产":
# 无生产任务且当前工单下无其它报工记录时时,撤回直接删除工单
work_order.unlink()
......@@ -109,7 +108,9 @@ class InheritRokeWorkRecordModel(models.Model):
for repair in v.repair_line_ids:
if repair.repair_work_order_id.record_ids:
raise ValidationError("返修明细中的返修工单已报工,无法撤销报工!")
repair.repair_work_order_id.unlink()
for scrap in v.scrap_line_ids:
if scrap.scrap_work_order_ids.record_ids:
raise ValidationError("返修明细中的返修工单已报工,无法撤销报工!")
scrap.scrap_work_order_ids.unlink()
super(InheritRokeWorkRecordModel, self).withdraw()
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