新增返工向导

This commit is contained in:
jinling.yang
2024-07-03 17:35:29 +08:00
parent 93c3548b40
commit a7a8e73616
9 changed files with 142 additions and 11 deletions

View File

@@ -1 +1,2 @@
from . import workpiece_delivery_wizard
from . import rework_wizard

View File

@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Part of YiZuo. See LICENSE file for full copyright and licensing details.
import logging
from odoo.exceptions import UserError, ValidationError
from datetime import datetime
from odoo import models, api, fields, _
class ReworkWizard(models.TransientModel):
_name = 'sf.rework.wizard'
_description = '返工向导'
workorder_id = fields.Many2one('mrp.workorder', string='工单')
production_ids = fields.Many2many('mrp.production', string='制造订单号')
rework_reason = fields.Selection(
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
routing_type = fields.Selection([
('装夹预调', '装夹预调'),
('CNC加工', 'CNC加工')], string="工序类型")
def confirm(self):
self.production_ids.detection_result_ids.write((0, 0, {
'rework_reason': self.rework_reason,
'detailed_reason': self.detailed_reason,
'processing_panel': self.workorder_id.processing_panel,
'routing_type': self.workorder_id.routing_type,
'test_results': self.workorder_id.test_results,
'test_report': self.workorder_id.detection_report}))

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="sf_rework_wizard_form_view">
<field name="name">sf.rework.wizard.form.view</field>
<field name="model">sf.rework.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<field name="production_ids" invisible="True"/>
<field name="workorder_id" invisible="True"/>
<group>
<field name="rework_reason" required="1"/>
<field name="detailed_reason" required="1"/>
</group>
<footer>
<button string="确认" name="confirm" type="object" class="oe_highlight" confirm="是否确认返工"/>
<button string="取消" class="btn btn-secondary" special="cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
<record id="action_sf_rework_wizard" model="ir.actions.act_window">
<field name="name">返工</field>
<field name="res_model">sf.rework.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>