From 49f021ed7a9c68ab9f848d22e2be7050e423d6d0 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 17 Nov 2023 17:45:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=88=80=E7=89=87=E5=BD=A2=E7=8A=B6=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E5=90=88=E5=8A=A0=E5=B7=A5=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=88=80=E5=B0=96=E7=89=B9=E5=BE=81=EF=BC=8C=E8=B5=B0=E5=88=80?= =?UTF-8?q?=E6=96=B9=E5=90=91=EF=BC=8C=E6=9F=84=E9=83=A8=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=86=B7=E5=8D=B4=E6=B6=B2=EF=BC=8C=E5=8E=8B=E7=B4=A7?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 131 ++++---------------- 1 file changed, 25 insertions(+), 106 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 73d3d4aa..f2e69239 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -204,16 +204,6 @@ class ResProductMo(models.Model): self.cutting_tool_blade_depth = self.specification_id.blade_depth self.cutting_tool_cut_depth = self.specification_id.cutting_depth self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids - # # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids. - # for tooth in self.cutting_tool_model_id.feed_per_tooth_ids: - # print(int(tooth.blade_diameter)) - # print(int(self.specification_id.blade_diameter)) - # if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter): - # self.feed_per_tooth_ids = [(0, 0, { - # 'cutting_speed': tooth.cutting_speed, - # 'machining_method': tooth.machining_method, - # 'blade_diameter': tooth.blade_diameter, - # 'materials_type_id': tooth.materials_type_id.id})] self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered( lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter)) elif self.cutting_tool_type == '夹头': @@ -358,89 +348,33 @@ class ResProductMo(models.Model): self.cutting_speed_ids = False self.feed_per_tooth_ids = False - # @api.constrains('suitable_machining_method_ids') - # def _check_suitable_machining_method_ids(self): - # for record in self: - # if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("适合加工方式不能为空!") - # - # @api.constrains('blade_tip_characteristics_ids') - # def _check_blade_tip_characteristics_ids(self): - # for record in self: - # if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("刀尖特征不能为空!") - # if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("刀尖特征只能单选!") - # - # @api.constrains('handle_type_ids') - # def _check_handle_type_ids(self): - # for record in self: - # if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("柄部类型不能为空!") - # if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("柄部类型只能单选!") - # - # @api.constrains('cutting_direction_ids') - # def _check_cutting_direction_ids(self): - # for record in self: - # if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("走刀方向不能为空!") - # - # @api.constrains('suitable_coolant_ids') - # def _check_suitable_coolant_ids(self): - # for record in self: - # if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("适合冷却液不能为空!") - # - # @api.constrains('cutting_tool_total_length') - # def _check_cutting_tool_total_length(self): - # if self.cutting_tool_total_length <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("总长度不能为0") - # - # @api.constrains('cutting_tool_shank_length') - # def _check_cutting_tool_shank_length(self): - # if self.cutting_tool_shank_length <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("柄部长度不能为0") - # - # @api.constrains('cutting_tool_blade_length') - # def _check_cutting_tool_blade_length(self): - # if self.cutting_tool_blade_length <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("刃部长度不能为0") - # - # @api.constrains('cutting_tool_blade_number') - # def _check_cutting_tool_blade_number(self): - # if self.cutting_tool_blade_number <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("刃数不能为0") - # - # @api.constrains('integral_shank_diameter') - # def _check_integral_shank_diameter(self): - # if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("柄部直径不能为0") - # - # @api.constrains('integral_blade_diameter') - # def _check_integral_blade_diameter(self): - # if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("刃部直径不能为0") - # - # @api.constrains('integral_run_out_accuracy_min') - # def _check_integral_blade_diameter(self): - # if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("端跳精度最小(min)不能为0") + @api.constrains('fit_blade_shape_id', 'suitable_machining_method_ids', 'blade_tip_characteristics_id', + 'handle_type_ids', 'cutting_direction_ids', 'suitable_coolant_ids', 'compaction_way_ids') + def _check_cutting_tool_ability(self): + if self.cutting_tool_type in ['整体式刀具', '刀片', '刀杆', '刀盘']: + if self.cutting_tool_type in ['刀片', '刀杆', '刀盘']: + if not self.fit_blade_shape_id: + raise ValidationError("请选择适配刀片形状") + if self.cutting_tool_type in ['刀杆', '刀盘']: + if not self.compaction_way_ids: + raise ValidationError("请选择压紧方式") + if self.cutting_tool_type == '刀片': + if not self.suitable_coolant_ids: + raise ValidationError("请选择适合冷却液") + elif self.cutting_tool_type == '整体式刀具': + if not self.handle_type_ids: + raise ValidationError("请选择柄部类型") + if not self.suitable_coolant_ids: + raise ValidationError("请选择适合冷却液") + if not self.suitable_machining_method_ids: + raise ValidationError("请选择适合加工方式") + if not self.blade_tip_characteristics_id: + raise ValidationError("请选择刀尖特征") + if not self.cutting_direction_ids: + raise ValidationError("请选择走刀方向") cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc') feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz') - - # @api.constrains('suitable_machining_method_ids') - # def _check_suitable_machining_method_ids(self): - # for record in self: - # if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("适合加工方式不能为空!") - - # @api.constrains('integral_run_out_accuracy_max') - # def _check_integral_run_out_accuracy_max(self): - # if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具': - # raise ValidationError("端跳精度最大(max)不能为0") - cutting_tool_diameter = fields.Float('直径(mm)') cutting_tool_rear_angle = fields.Integer('后角(°)') cutting_tool_main_included_angle = fields.Integer('主偏角(°)') @@ -758,26 +692,19 @@ class ResProductMo(models.Model): 'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']), 'model_name': attachment.name, 'upload_model_file': [(6, 0, [attachment.id])], - # 'tag_ids': [(6, 0, [t.id for t in account_template.tag_ids])], - # 'single_manufacturing': True, - # 'tracking': 'serial', 'list_price': item['price'], - # 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id, 'materials_id': self.env['sf.production.materials'].search( [('materials_no', '=', item['texture_code'])]).id, 'materials_type_id': self.env['sf.materials.model'].search( [('materials_no', '=', item['texture_type_code'])]).id, - # 'model_surface_process_ids': self.get_production_process_id(item['surface_process_code']), 'model_process_parameters_ids': [(6, 0, [])] if not item.get( 'process_parameters_code') else self.get_process_parameters_id(item['process_parameters_code']), 'model_remark': item['remark'], 'default_code': '%s-%s' % (order_number, i), - # 'barcode': item['barcode'], 'active': True, - # 'route_ids': self._get_routes('') } copy_product_id.sudo().write(vals) - # product_id.product_tmpl_id.active = False + product_id.product_tmpl_id.active = False return copy_product_id def _get_ids(self, param): @@ -833,12 +760,6 @@ class ResProductMo(models.Model): 'materials_id': materials_id.id, 'materials_type_id': materials_type_id.id, 'is_bfm': True, - # 'route_ids': self._get_routes(route_type), - # 'categ_id': self.env.ref('sf_dlm.product_category_embryo_sf').id, - # 'model_surface_process_id': self.env['sf.production.process'].search( - # [('process_encode', '=', item['surface_process_code'])]).id, - # 'model_process_parameters_id': self.env['sf.processing.technology'].search( - # [('process_encode', '=', item['process_parameters_code'])]).id, 'active': True } # 外协和采购生成的坯料需要根据材料型号绑定供应商 @@ -850,8 +771,6 @@ class ResProductMo(models.Model): partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)]) partner.is_subcontractor = True no_bom_copy_product_id.write(vals) - logging.info('no_bom_copy_product_id-vals:%s' % vals) - # product_id.product_tmpl_id.active = False return no_bom_copy_product_id @api.model_create_multi From 1da7a0195d8420a6cb5d3af1f5c974bd44c4d9ba Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 20 Nov 2023 14:59:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=A0=B9=E6=8D=AEodoo=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9py=E6=96=87=E4=BB=B6=E4=B8=AD=E5=BE=97import?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/commons/common.py | 2 +- sf_base/models/base.py | 2 +- sf_base/models/common.py | 4 +--- sf_maintenance/models/sf_maintenance.py | 8 +++----- sf_manufacturing/models/mrp_maintenance.py | 3 ++- sf_manufacturing/models/product_template.py | 4 ++-- sf_manufacturing/models/stock.py | 9 +++------ sf_mrs_connect/models/sync_common.py | 4 ++-- sf_sale/models/auto_quatotion_common.py | 2 +- sf_sale/models/quick_easy_order.py | 4 ++-- 10 files changed, 18 insertions(+), 24 deletions(-) diff --git a/sf_base/commons/common.py b/sf_base/commons/common.py index 0c4021ea..a1aed3c2 100644 --- a/sf_base/commons/common.py +++ b/sf_base/commons/common.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from odoo import models import time import hashlib +from odoo import models class Common(models.Model): diff --git a/sf_base/models/base.py b/sf_base/models/base.py index 966ccdc5..066e84e1 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -import requests import json +import requests from odoo import fields, models, api from odoo.exceptions import ValidationError from odoo.addons.sf_base.commons.common import Common diff --git a/sf_base/models/common.py b/sf_base/models/common.py index f116b50f..7ec20654 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import logging -from odoo import fields, models -import requests -from odoo.addons.sf_base.commons.common import Common from urllib.parse import urlencode +from odoo import fields, models _logger = logging.getLogger(__name__) diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index c44f283c..bf58c8f2 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- +import json import base64 - -from odoo import api, fields, models, SUPERUSER_ID, _ -from odoo.exceptions import UserError -import logging from datetime import date, datetime, timedelta import requests -import json from odoo.addons.sf_base.commons.common import Common +from odoo import api, fields, models, SUPERUSER_ID, _ +from odoo.exceptions import UserError class SfMaintenanceEquipmentCategory(models.Model): diff --git a/sf_manufacturing/models/mrp_maintenance.py b/sf_manufacturing/models/mrp_maintenance.py index f0b09e8d..f55f9014 100644 --- a/sf_manufacturing/models/mrp_maintenance.py +++ b/sf_manufacturing/models/mrp_maintenance.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, fields, models, _ from dateutil.relativedelta import relativedelta +from odoo import api, fields, models, _ + class MaintenanceEquipment(models.Model): diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index b6961fda..acc4242a 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -3,8 +3,8 @@ from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path from odoo.addons.sf_base.commons.common import Common -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 import logging import base64 import hashlib diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 8dd0062d..ac6ee4c4 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -1,18 +1,15 @@ # -*- coding: utf-8 -*- +import logging import base64 from collections import defaultdict, namedtuple -from odoo.addons.stock.models.stock_rule import ProcurementException -from odoo.addons.sf_base.commons.common import Common -from odoo.exceptions import ValidationError, UserError import requests -import json from re import findall as regex_findall from datetime import datetime, timedelta from re import split as regex_split from odoo import SUPERUSER_ID, _, api, fields, models from odoo.tools import float_compare -import logging - +from odoo.addons.stock.models.stock_rule import ProcurementException +from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import UserError diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 6d5a819c..7439c87b 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -import requests +import logging import json import base64 +import requests from odoo import models from odoo.exceptions import ValidationError -import logging from odoo.addons.sf_base.commons.common import Common _logger = logging.getLogger(__name__) diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 4631fdee..2d34a76e 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -from quatotion import readSql, feature_recognize, auto_quatotion +#from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index e9f152a8..310bbc7a 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -1,7 +1,7 @@ from odoo import models, fields, api 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 from odoo.exceptions import ValidationError, UserError from odoo.addons.sf_base.commons.common import Common from datetime import datetime From 7ceaadb9c40880a6849a34c34d2f119eed775504 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 20 Nov 2023 15:04:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/functional_fixture.py | 5 +++-- sf_manufacturing/models/product_template.py | 15 ++++++------- sf_manufacturing/models/stock.py | 13 +++++------ sf_sale/models/quick_easy_order.py | 17 ++++++++------ sf_sale/models/sale_order.py | 3 +-- sf_wxwork_approval/controllers/controllers.py | 22 +++---------------- sf_wxwork_approval/models/model.py | 14 +----------- 7 files changed, 30 insertions(+), 59 deletions(-) diff --git a/sf_base/models/functional_fixture.py b/sf_base/models/functional_fixture.py index c96466c1..854ba53e 100644 --- a/sf_base/models/functional_fixture.py +++ b/sf_base/models/functional_fixture.py @@ -1,8 +1,9 @@ +import requests +import json from odoo import models, fields, api from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import ValidationError -import requests -import json + class FunctionalFixtureType(models.Model): diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index f2e69239..59ae7f6a 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- -from odoo import models, fields, api, _ -from odoo.exceptions import ValidationError -from odoo.modules import get_resource_path -from odoo.addons.sf_base.commons.common import Common -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file import logging import base64 import hashlib import os -import requests -import json +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError +from odoo.modules import get_resource_path +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file + + class ResProductMo(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index bad89ac0..aaf261e8 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -1,18 +1,15 @@ # -*- coding: utf-8 -*- +from datetime import datetime +import requests +import logging import base64 from collections import defaultdict, namedtuple +from re import findall as regex_findall +from re import split as regex_split from odoo.addons.stock.models.stock_rule import ProcurementException from odoo.addons.sf_base.commons.common import Common -from odoo.exceptions import ValidationError, UserError -import requests -import json -from re import findall as regex_findall -from datetime import datetime, timedelta -from re import split as regex_split from odoo import SUPERUSER_ID, _, api, fields, models from odoo.tools import float_compare -import logging - from odoo.exceptions import UserError diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index e9f152a8..2fc95d62 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -1,16 +1,19 @@ -from odoo import models, fields, api -from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file -from odoo.exceptions import ValidationError, UserError -from odoo.addons.sf_base.commons.common import Common -from datetime import datetime import logging import base64 import hashlib import os import json +from datetime import datetime import requests +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 +from odoo.addons.sf_base.commons.common import Common + + + class QuickEasyOrder(models.Model): diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 35d877fe..ee799cab 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -1,7 +1,7 @@ -from odoo import models, fields import datetime import base64 import logging +from odoo import models, fields class ReSaleOrder(models.Model): @@ -17,7 +17,6 @@ class ReSaleOrder(models.Model): # 业务平台分配工厂后在智能工厂先创建销售订单 def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address, deadline_of_delivery, payments_way, pay_way): - logging.info('---------sale_order_create------') now_time = datetime.datetime.now() partner = self.get_customer() order_id = self.env['sale.order'].sudo().create({ diff --git a/sf_wxwork_approval/controllers/controllers.py b/sf_wxwork_approval/controllers/controllers.py index e52058d4..bc981b49 100644 --- a/sf_wxwork_approval/controllers/controllers.py +++ b/sf_wxwork_approval/controllers/controllers.py @@ -1,25 +1,9 @@ # -*- coding: utf-8 -*- -import ast -import base64 -import io -import json -import os -import random -import time - -import re - -from stl import mesh -from werkzeug import urls - -import odoo -from odoo.exceptions import ValidationError import requests -from odoo import http -from odoo.http import request, Response -from odoo.modules import get_resource_path -from odoo.tools.translate import _ import logging +from odoo import http +from odoo.http import request + _logger = logging.getLogger(__name__) diff --git a/sf_wxwork_approval/models/model.py b/sf_wxwork_approval/models/model.py index ba1cf15a..8fb3f516 100644 --- a/sf_wxwork_approval/models/model.py +++ b/sf_wxwork_approval/models/model.py @@ -1,19 +1,7 @@ # -*- coding: utf-8 -*- import re import logging -import time -import requests -from datetime import datetime -import base64 -import hashlib -from odoo import fields, models, api -import json -import requests -from odoo.http import request -from odoo.exceptions import ValidationError -from odoo.exceptions import UserError - - +from odoo import fields, models _logger = logging.getLogger(__name__) From 04e63dcc599299726094f27823c65a4c00134708 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 20 Nov 2023 15:10:01 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/controllers/controllers.py | 4 ++-- sf_manufacturing/models/mrp_production.py | 2 +- sf_sale/models/quick_easy_order.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py index 69fb8f30..de974b05 100644 --- a/sf_bf_connect/controllers/controllers.py +++ b/sf_bf_connect/controllers/controllers.py @@ -59,7 +59,7 @@ class Sf_Bf_Connect(http.Controller): self_machining_bom_line = self_machining_bom.with_user( request.env.ref("base.user_admin")).bom_create_line( self_machining_embryo) - if self_machining_bom_line == False: + if self_machining_bom_line is False: res['status'] = 2 res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配' request.cr.rollback() @@ -84,7 +84,7 @@ class Sf_Bf_Connect(http.Controller): # 创建坯料的bom的组件 outsource_bom_line = outsource_bom.with_user( request.env.ref("base.user_admin")).bom_create_line(outsource_embryo) - if outsource_bom_line == False: + if outsource_bom_line is False: res['status'] = 2 res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配' request.cr.rollback() diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index b6d774a3..42e70d14 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -120,7 +120,7 @@ class MrpProduction(models.Model): if i == 1 and route.routing_type == '获取CNC加工程序': workorders_values.append( self.env['mrp.workorder'].json_workorder_str('', production, route)) - if route.is_repeat == True: + if route.is_repeat is True: workorders_values.append( self.env['mrp.workorder'].json_workorder_str(k, production, route)) if i == processing_panel_len and route.routing_type == '解除装夹': diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 2fc95d62..1e5f274c 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -212,7 +212,7 @@ class QuickEasyOrder(models.Model): self_machining_bom = self.env['mrp.bom'].bom_create(self_machining_embryo, 'normal', False) # 创建坯料里bom的组件 self_machining_bom_line = self_machining_bom.bom_create_line(self_machining_embryo) - if self_machining_bom_line == False: + if self_machining_bom_line is False: self.cr.rollback() return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配') # 产品配置bom @@ -228,7 +228,7 @@ class QuickEasyOrder(models.Model): # 创建坯料的bom的组件 outsource_bom_line = outsource_bom.with_user( self.env.ref("base.user_admin")).bom_create_line(outsource_embryo) - if outsource_bom_line == False: + if outsource_bom_line is False: self.cr.rollback() return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配') # 产品配置bom From 499261f62e7505c1a3865bb4717d57178e18e367 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 20 Nov 2023 15:39:07 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=94=BE=E5=BC=80=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 4 ++-- sf_sale/models/auto_quatotion_common.py | 24 ++++++++++----------- sf_sale/models/quick_easy_order.py | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index acc4242a..b6961fda 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -3,8 +3,8 @@ from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path from odoo.addons.sf_base.commons.common import Common -#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 import logging import base64 import hashlib diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 2d34a76e..09ea3f0f 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -#from quatotion import readSql, feature_recognize, auto_quatotion +from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) @@ -24,14 +24,14 @@ class AutoQuatotion(models.Model): def get_process_time_db_path(self): return get_resource_path('sf_sale', 'models', 'process_time.db') - # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): - # ''' - # 通过打包好的.so库, - # 以调用autoQuatotion库中Quatotion类, - # 初始化后调用类的analyseShape方法对模型文件进行价格预测 - # ''' - # # 初始化自动报价类(输入特征数据库和加工时间数据库) - # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) - # # 获取价格、加工时间、尺寸、XYZ、翻面次数 - # feature_info = reader.analyseShape(stp_url, InfoJson={}) - # return feature_info + def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): + ''' + 通过打包好的.so库, + 以调用autoQuatotion库中Quatotion类, + 初始化后调用类的analyseShape方法对模型文件进行价格预测 + ''' + # 初始化自动报价类(输入特征数据库和加工时间数据库) + reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) + # 获取价格、加工时间、尺寸、XYZ、翻面次数 + feature_info = reader.analyseShape(stp_url, InfoJson={}) + return feature_info diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 310bbc7a..e9f152a8 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -1,7 +1,7 @@ from odoo import models, fields, api 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 from odoo.exceptions import ValidationError, UserError from odoo.addons.sf_base.commons.common import Common from datetime import datetime From 580f95f33851143daffd668c2ed68daa94117955 Mon Sep 17 00:00:00 2001 From: "qihao.gong@jikimo.com" Date: Mon, 20 Nov 2023 15:48:43 +0800 Subject: [PATCH 6/6] =?UTF-8?q?importrequests=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index ca3e1c10..a2f5b129 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import base64 -import requests import logging from re import findall as regex_findall from datetime import datetime, timedelta from re import split as regex_split +import requests from odoo import SUPERUSER_ID, _, api, fields, models from odoo.tools import float_compare from collections import defaultdict, namedtuple