diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index a1cc56d2..d60a2497 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -388,9 +388,12 @@ class MrpProduction(models.Model): def technology_confirm(self): process_parameters = [] account_moves = [] + parameters_not = [] special_design = self.technology_design_ids.filtered( lambda a: a.routing_tag == 'special' and a.is_auto is False) for special in special_design: + if special.route_id.routing_type == '表面工艺' and not special.process_parameters_id: + parameters_not.append(special.route_id.name) if special.process_parameters_id: product_production_process = self.env['product.template'].search( [('server_product_process_parameters_id', '=', special.process_parameters_id.id)]) @@ -404,6 +407,8 @@ class MrpProduction(models.Model): account_moves.append(purchase.name) if account_moves: raise UserError(_("请联系工厂生产经理对采购订单为%s生成的账单进行取消", ", ".join(account_moves))) + if parameters_not: + raise UserError(_("【工艺设计】-【工序】为%s未选择参数,请选择", ", ".join(parameters_not))) if process_parameters: raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters))) # 判断同一个加工面的标准工序的顺序是否依次排序 diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 63afbb18..3d55c6f1 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -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 @@ -1195,11 +1195,12 @@ class ResMrpWorkOrder(models.Model): raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name) self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name # cnc校验 - cnc_workorder = self.search( - [('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')], - limit=1, order='id asc') - if not cnc_workorder.cnc_ids: - raise UserError(_('该制造订单还未下发CNC程序,请稍后再试')) + if self.production_id.production_type == '自动化产线加工': + cnc_workorder = self.search( + [('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')], + limit=1, order='id asc') + if not cnc_workorder.cnc_ids: + raise UserError(_('该制造订单还未下发CNC程序,请稍后再试')) else: if self.production_id.tool_state in ['1', '2']: if self.production_id.tool_state == '1': diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index f5f685aa..ebbf5bd2 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 081807a4..cb1886a1 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -8,8 +8,8 @@ from datetime import datetime import requests from odoo import http from odoo.http import request -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 87848e3a..d963d021 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -5,8 +5,8 @@ import requests import os from datetime import datetime # from OCC.Core.GProp import GProp_GProps -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file from odoo.addons.sf_base.commons.common import Common from odoo import models, fields, api from odoo.modules import get_resource_path