优化制造订单菜单

This commit is contained in:
jinling.yang
2024-07-04 17:31:03 +08:00
parent 050e82673a
commit 52fa229896
5 changed files with 82 additions and 16 deletions

View File

@@ -102,6 +102,9 @@ class MrpProduction(models.Model):
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
precision_rounding=production.product_uom_id.rounding) >= 0:
production.state = 'to_close'
elif any(
wo.test_results == '返工' and wo.state == 'done' for wo in production.workorder_ids):
production.state = 'rework'
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
production.state = 'progress'
elif production.product_uom_id and not float_is_zero(production.qty_producing,

View File

@@ -957,7 +957,6 @@ class ResMrpWorkOrder(models.Model):
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待解除装夹'
if record.test_results in ['返工']:
record.production_id.state = 'rework'
record.production_id.write({'detection_result_ids': [(0, 0, {
'rework_reason': record.reason,
'detailed_reason': record.detailed_reason,