1、去除工单开始按钮的二次确认;2、优化托盘入库后夹具物料查询中的状态还是未入库的问题

This commit is contained in:
yuxianghui
2025-01-06 13:11:22 +08:00
parent a7c3a604a6
commit bc475441a2
3 changed files with 22 additions and 10 deletions

View File

@@ -1058,16 +1058,18 @@ class ResMrpWorkOrder(models.Model):
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'
if workorder.is_subcontract is True:
purchase_orders_id = self._get_surface_technics_purchase_ids()
if purchase_orders_id.state == 'purchase':
workorder.state = 'ready'
move_out = workorder.move_subcontract_workorder_ids[1]
for mo in move_out:
if mo.state != 'done':
mo.write({'state': 'assigned', 'production_id': False})
continue
else:
workorder.state = 'waiting'
continue
else:
workorder.state = 'ready'
continue
else:
workorder.state = 'waiting'
continue
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
@@ -1091,11 +1093,17 @@ class ResMrpWorkOrder(models.Model):
if workorder.is_subcontract is False:
workorder.state = 'ready'
else:
if len(workorder.production_id.picking_ids.filtered(
lambda w: w.state not in ['done',
'cancel'])) == 0 and workorder.production_id.programming_state == '已编程':
workorder.state = 'ready'
purchase_orders_id = self._get_surface_technics_purchase_ids()
if purchase_orders_id:
workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting'
else:
workorder.state = 'waiting'
if purchase_orders_id.state == 'purchase':
move_out = workorder.move_subcontract_workorder_ids[1]
for mo in move_out:
if mo.state != 'done':
mo.write({'state': 'assigned', 'production_id': False})
# 重写工单开始按钮方法
def button_start(self):

View File

@@ -172,7 +172,7 @@
<!-- <button name="button_start" type="object" string="开始" class="btn-success" confirm="是否确认开始"-->
<!-- attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel','to be detected')), ('is_user_working', '!=', False)]}"/>-->
<button name="button_start" type="object" string="开始" class="btn-success" confirm="是否确认开始"
<button name="button_start" type="object" string="开始" class="btn-success"
attrs="{'invisible': [('state', '!=', 'ready')]}"/>
<button name="button_pending" type="object" string="暂停" class="btn-warning"
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>

View File

@@ -143,6 +143,10 @@ class StockLot(models.Model):
record.tool_material_status = '报废'
else:
record.tool_material_status = '未入库'
elif record.product_id.categ_id.name in ['夹具']:
if (record.quant_ids and record.quant_ids[-1].location_id.name in ['夹具房']
and record.tool_material_status == '未入库'):
record.tool_material_status = '可用'
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):