Commit c4f7b918 by 夏超

[fix] 返修单生产工单产品问题

parent 8c1d8ccb
......@@ -20,7 +20,7 @@ class JzjxInheritProduction(InheritProduction):
:return:
"""
res = super(JzjxInheritProduction, self)._get_work_record_values(wo, values)
repair_product_id = values.get('process_id', False) # 工序
if repair_product_id:
res.update({"repair_product_id": repair_product_id})
repair_process_id = values.get('process_id', False) # 工序
if repair_process_id:
res.update({"repair_process_id": repair_process_id})
return res
......@@ -55,7 +55,7 @@
<field name="inherit_id" ref="roke_mes_production.roke_mes_production_inherit_config_settings_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='production_setting_main']" position="inside">
<div class="col-12 col-lg-6 o_setting_box" title="返修自动生工单" id="refix_auto_work_order">
<div class="col-12 col-lg-6 o_setting_box" title="返修自动生工单" id="refix_auto_work_order">
<div class="o_setting_left_pane">
<field name="refix_auto_work_order"/>
</div>
......
......@@ -7,7 +7,7 @@ from odoo.exceptions import ValidationError
class InheritRokeCreateWorkRecordWizard(models.TransientModel):
_inherit = "roke.create.work.record.wizard"
repair_product_id = fields.Many2one("roke.process", string="工序")
repair_process_id = fields.Many2one("roke.process", string="工序")
def create_other_order(self, new_record):
"""
......@@ -18,12 +18,12 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel):
res = super(InheritRokeCreateWorkRecordWizard, self).create_other_order(new_record)
repair = res.get("repair", False)
refix_params = self.env['ir.config_parameter'].sudo().get_param("refix_auto_work_order")
if repair and self.repair_qty and (refix_params == "True" or refix_params is True) and self.repair_product_id:
if repair and self.repair_qty and (refix_params == "True" or refix_params is True) and self.repair_process_id:
repair.is_refix_auto_work_order = refix_params == "True" or refix_params is True
for v in repair.line_ids:
repair_work_order_id = self.env["roke.work.order"].create({
"process_id": new_record.process_id.id,
"product_id": self.repair_product_id.id,
"process_id": self.repair_process_id.id,
"product_id": new_record.work_order_id.product_id.id,
"plan_qty": v.qty,
"sequence": 1,
"planned_start_time": datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
......
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