Commit 86b27971 by 夏超

[fix] 修改问题

parent 7dac4689
......@@ -13,5 +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="返修工单")
repair_work_order_id = fields.Many2one("roke.work.order", string="返修工单", ondelete='cascade')
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="返修工单")
scrap_work_order_ids = fields.Many2many("roke.work.order", string="补件工单", ondelete='cascade')
is_rfe = fields.Boolean(string="是否工单补件")
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class InheritWorkOrder(models.Model):
......@@ -88,3 +89,21 @@ class InheritWorkOrder(models.Model):
else:
previous_multiple = previous.routing_line_id.multiple
return (multiple / previous_multiple) if previous_multiple else 0
class InheritRokeWorkRecordModel(models.Model):
_inherit = "roke.work.record"
def withdraw(self):
"""
撤回报工
:return:
"""
for v in self:
for repair in v.repair_line_ids:
if repair.repair_work_order_id.record_ids:
raise ValidationError("返修明细中的返修工单已报工,无法撤销报工!")
for scrap in v.scrap_line_ids:
if scrap.scrap_work_order_ids.record_ids:
raise ValidationError("返修明细中的返修工单已报工,无法撤销报工!")
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