工艺确认时的工单空值处理
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import logging
|
||||
from itertools import groupby
|
||||
from odoo import models, api, fields, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class ProductionTechnologyWizard(models.TransientModel):
|
||||
@@ -88,7 +89,10 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
for item in productions:
|
||||
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||
key=lambda a: a.sequence)
|
||||
if workorder[0].state in ['pending']:
|
||||
if workorder[0].production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
||||
workorder[0].state = 'waiting'
|
||||
first_element = workorder[0] if workorder else None
|
||||
if not first_element:
|
||||
raise UserError('工艺确认后,工单未生成,请检查配置')
|
||||
if first_element.state in ['pending']:
|
||||
if first_element.production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
||||
first_element.state = 'waiting'
|
||||
return productions
|
||||
|
||||
Reference in New Issue
Block a user