1、返工向导模型添加新的工单字段;2、工单tree视图添加重新加工分类

This commit is contained in:
yuxianghui
2024-11-26 11:14:45 +08:00
parent 7f5f65f07f
commit 0a1da79487
5 changed files with 14 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
<field name="state" select="multi" string="状态" icon="fa-building" enable_counters="1"/>
<field name="construction_period_status" select="multi" icon="fa-building" enable_counters="1"/>
<field name="tag_type" select="multi" icon="fa-building" enable_counters="1"/>
<!-- <field name="manual_quotation" select="multi" string="" icon="fa-building" enable_counters="1"/>-->
</searchpanel>

View File

@@ -141,8 +141,8 @@ class ResMrpWorkOrder(models.Model):
# 是否绑定托盘
is_trayed = fields.Boolean(string='是否绑定托盘', default=False)
tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True)
technology_design_id = fields.Many2one('sf.technology.design')
def _compute_default_construction_period_status(self):
@@ -281,7 +281,7 @@ class ResMrpWorkOrder(models.Model):
# if technology_design.is_auto is False:
# domain = [('origin', '=', order.production_id.name)]
# else:
domain = [('purchase_type', '=', 'consignment'),('origin', '=', ','.join(production_list))]
domain = [('purchase_type', '=', 'consignment'), ('origin', '=', ','.join(production_list))]
purchase = self.env['purchase.order'].search(domain)
if not purchase:
order.surface_technics_purchase_count = 0
@@ -1075,6 +1075,13 @@ class ResMrpWorkOrder(models.Model):
if workorder.state != 'pending':
workorder.state = 'pending'
continue
# ================= 如果制造订单制造类型为【人工线下加工】==========================
if (workorder.production_id.production_type == '人工线下加工'
and workorder.production_id.schedule_state == '已排'
and len(workorder.production_id.picking_ids.filtered(
lambda w: w.state not in ['done', 'cancel'])) == 0):
workorder.state = 'ready'
continue
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
or workorder.production_id.schedule_state != '已排'

View File

@@ -32,6 +32,7 @@
</field>
<xpath expr="//field[@name='qty_remaining']" position="after">
<field name="manual_quotation" optional="show"/>
<field name="tag_type" optional="show"/>
<field name="construction_period_status" optional="show" widget="badge"
decoration-success="construction_period_status == '正常'"
decoration-warning="construction_period_status == '预警'"

View File

@@ -15,6 +15,8 @@ class ReworkWizard(models.TransientModel):
production_id = fields.Many2one('mrp.production', string='制造订单号')
workorder_ids = fields.Many2many('mrp.workorder', 'rework_wizard_to_work_order', string='所有工单',
domain="[('production_id', '=', production_id),('state','=','done')]")
hidden_workorder_ids = fields.Many2many('mrp.workorder', 'rework_wizard_to_work_order_hidden',
string='所有工单(hidden)')
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
("operate computer", "操机"),

View File

@@ -12,6 +12,7 @@
<field name="tool_state" invisible="True"/>
<field name="routing_type" invisible="True"/>
<field name="processing_panel_id" invisible="1"/>
<field name="hidden_workorder_ids" invisible="1"/>
<group>
<field name="workorder_ids" string="工序" attrs='{"invisible": [("routing_type","=","装夹预调")]}'>
<tree create="0" editable='bottom' delete="0">