From 1e1ed20231ffe3f64161687326a181e6451e86c4 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Mon, 28 Aug 2023 10:00:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=80=E5=85=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=A0=E7=B2=97=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=20=20=20zpl=5Fprint,web=5Fwidget=E6=A8=A1=E5=9D=97=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20'license':=20'LGPL-3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 2 +- sf_tool_management/views/tool_base_views.xml | 4 ++-- web_widget_model_viewer/__manifest__.py | 4 +++- zpl_print/__manifest__.py | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index d39b92fa..0e63b374 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -13,7 +13,7 @@ class FunctionalCuttingToolEntity(models.Model): _description = '功能刀具列表' code = fields.Char('编码') - name = fields.Char('名称') + name = fields.Char('名称', required=True, size=20) mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='刀具型号') mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', tracking=True, group_expand='_read_group_mrs_cutting_tool_type_ids') diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index d7254f4a..8ded8198 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -29,12 +29,12 @@

- +

- + Date: Mon, 28 Aug 2023 17:40:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1.=E6=A8=A1=E5=9E=8B=E4=B8=BA=E4=B8=8A?= =?UTF-8?q?=E8=89=B2Bug=E4=BF=AE=E5=A4=8D=EF=BC=88cloud=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=BC=95=E8=B5=B7=EF=BC=89=202.=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E4=BA=A7=E5=93=81=E5=92=8C=E8=AE=A2=E5=8D=95=E6=9C=AA?= =?UTF-8?q?=E6=88=90=E5=8A=9FBug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/common.py | 6 + sf_base/views/common_view.xml | 2 +- sf_sale/models/quick_easy_order.py | 172 +++++++++++++++--------- sf_sale/views/quick_easy_order_view.xml | 6 +- web_widget_model_viewer/__manifest__.py | 3 +- 5 files changed, 123 insertions(+), 66 deletions(-) diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 2e2cccf6..814dabb7 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -179,3 +179,9 @@ class MrsProductionProcessParameter(models.Model): def get_gain_way(self, item): process_parameter = self.env['sf.production.process.parameter'].search([('id', '=', item.id)]) return process_parameter + + def _json_production_process_item_code(self, item): + code_arr = [] + for i in item.parameter_ids: + code_arr.append(i.code) + return code_arr diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index 58d2419b..aab5cf1f 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -115,7 +115,7 @@ sf.production.process -
+

diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index fe7aa0a4..73f73f5b 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -32,8 +32,8 @@ class QuickEasyOrder(models.Model): ('0.01', '±0.01mm')], string='加工精度', default='0.10') material_id = fields.Many2one('sf.production.materials', '材料', compute='_compute_material_model', store=True) material_model_id = fields.Many2one('sf.materials.model', '型号', compute='_compute_material_model', store=True) - process_id = fields.Many2one('sf.production.process', string='表面工艺') - parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数') + # process_id = fields.Many2one('sf.production.process', string='表面工艺') + parameter_ids = fields.Many2many('sf.production.process.parameter', 'process_item_order_rel', string='可选参数') quantity = fields.Integer('数量', default=1) unit_price = fields.Float('单价') price = fields.Float('总价') @@ -49,6 +49,11 @@ class QuickEasyOrder(models.Model): ('success', '成功'), ('fail', '失败')], string='模型上色状态') + @api.depends('unit_price', 'quantity') + def _compute_total_amount(self): + for item in self: + item.price = item.unit_price * item.quantity + @api.depends('material_id', 'material_model_id') def _compute_material_model(self): for item in self: @@ -75,18 +80,18 @@ class QuickEasyOrder(models.Model): logging.info('create-model_file:%s' % len(vals['model_file'])) obj = super(QuickEasyOrder, self).create(vals) - self.model_coloring() + self.model_coloring(obj) self.distribute_to_factory(obj) return obj # 将attach的datas内容转为glb文件 def transition_glb_file(self, report_path, model_code): shapes = read_step_file(report_path) - #output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl') + # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl') output_file = os.path.join('/tmp', str(model_code) + '.stl') write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) # 转化为glb - #output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb') + # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb') output_glb_file = os.path.join('/tmp', str(model_code) + '.glb') util_path = get_resource_path('sf_dlm', 'static/util') cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file) @@ -137,62 +142,106 @@ class QuickEasyOrder(models.Model): 派单到工厂 :return: """ - web_base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url', default='') - logging.info("web_base_url: %s" % web_base_url) - url = '/api/bfm_process_order/list' - res = {'order_number': obj.name, 'delivery_end_date': str(datetime.now()), - 'delivery_name': 'XXXXX', 'delivery_telephone': 'XXXXX', - 'delivery_address': 'XXXXX', - 'bfm_process_order_list': []} - factory = self.env['res.partner'].sudo().search([], limit=1, order='id desc') - config_header = Common.get_headers(self, factory.sf_token, factory.sf_secret_key) - for item in obj: - attachment = item.upload_model_file[0] - base64_data = base64.b64encode(attachment.datas) - base64_datas = base64_data.decode('utf-8') - barcode = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() - logging.info('model_file-size: %s' % len(item.model_file)) - val = { - 'model_long': item.model_length, - 'model_width': item.model_width, - 'model_height': item.model_height, - 'model_volume': item.model_volume, - 'model_machining_precision': item.machining_precision, - 'model_name': attachment.name, - 'model_data': base64_datas, - 'model_file': base64.b64encode(item.model_file).decode('utf-8'), - 'texture_code': item.material_id.materials_no, - 'texture_type_code': item.material_model_id.materials_no, - # 'surface_process_code': self.env['jikimo.surface.process']._json_surface_process_code(item), - # 'process_parameters_code': self.env['jikimo.surface.process.item']._json_surface_process_item_code( - # item), - 'price': item.price, - 'number': item.quantity, - 'total_amount': item.price, - 'remark': '', - 'barcode': barcode - } - res['bfm_process_order_list'].append(val) - res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list']) try: - ret = requests.post((web_base_url[0] + url), json={}, data=res, - headers=config_header) - ret = ret.json() - if ret['status'] == 1: - self.write( - {'state': '待接单'}) - else: - raise UserError(ret['message']) + res = {'bfm_process_order_list': []} + for item in obj: + attachment = item.upload_model_file[0] + base64_data = base64.b64encode(attachment.datas) + base64_datas = base64_data.decode('utf-8') + barcode = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() + logging.info('model_file-size: %s' % len(item.model_file)) + res['bfm_process_order_list'].append({ + 'model_long': item.model_length, + 'model_width': item.model_width, + 'model_height': item.model_height, + 'model_volume': item.model_volume, + 'model_machining_precision': item.machining_precision, + 'model_name': attachment.name, + 'model_data': base64_datas, + 'model_file': base64.b64encode(item.model_file).decode('utf-8'), + 'texture_code': item.material_id.materials_no, + 'texture_type_code': item.material_model_id.materials_no, + # 'surface_process_code': self.env['jikimo.surface.process']._json_surface_process_code(item), + 'process_parameters_code': self.env[ + 'sf.production.process.parameter']._json_production_process_item_code( + item), + 'price': item.price, + 'number': item.quantity, + 'total_amount': item.price, + 'remark': '', + 'barcode': barcode + }) + # res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list']) + product_id = self.env.ref('sf_dlm.product_template_sf').sudo() + self_machining_id = self.env.ref('sf_dlm.product_embryo_sf_self_machining').sudo() + outsource_id = self.env.ref('sf_dlm.product_embryo_sf_outsource').sudo() + purchase_id = self.env.ref('sf_dlm.product_embryo_sf_purchase').sudo() + company_id = self.env.ref('base.main_company').sudo() + # user_id = request.env.ref('base.user_admin').sudo() + order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX', + str(datetime.now())) + i = 1 + # 给sale_order的default_code字段赋值 + aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)]) + aa.default_code = obj.name + for item in res['bfm_process_order_list']: + product = self.env['product.template'].sudo().product_create(product_id, item, order_id, + obj.name, i) + bom_data = self.env['mrp.bom'].get_bom(product) + logging.info('bom_data:%s' % bom_data) + if bom_data: + bom = self.env['mrp.bom'].bom_create(product, 'normal', False) + bom.bom_create_line_has(bom_data) + else: + if product.materials_type_id.gain_way == '自加工': + # 创建坯料 + self_machining_embryo = self.env['product.template'].sudo().no_bom_product_create( + self_machining_id, + item, order_id, + 'self_machining', + i) + # 创建坯料的bom + 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: + self.cr.rollback() + return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配') + # 产品配置bom + product_bom_self_machining = self.env['mrp.bom'].bom_create(product, 'normal', False) + product_bom_self_machining.bom_create_line_has(self_machining_embryo) + elif product.materials_type_id.gain_way == '外协': + # 创建坯料 + outsource_embryo = self.env['product.template'].sudo().no_bom_product_create(outsource_id, item, + order_id, + 'subcontract', i) + # 创建坯料的bom + outsource_bom = self.env['mrp.bom'].bom_create(outsource_embryo, 'subcontract', True) + # 创建坯料的bom的组件 + outsource_bom_line = outsource_bom.with_user( + self.env.ref("base.user_admin")).bom_create_line(outsource_embryo) + if outsource_bom_line == False: + self.cr.rollback() + return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配') + # 产品配置bom + product_bom_outsource = self.env['mrp.bom'].bom_create(product, 'normal', False) + product_bom_outsource.bom_create_line_has(outsource_embryo) + elif product.materials_type_id.gain_way == '采购': + purchase_embryo = self.env['product.template'].sudo().no_bom_product_create(purchase_id, item, + order_id, + 'purchase', i) + # 产品配置bom + product_bom_purchase = self.env['mrp.bom'].bom_create(product, 'normal', False) + product_bom_purchase.bom_create_line_has(purchase_embryo) + order_id.with_user(self.env.ref("base.user_admin")).sale_order_create_line(product, item) except Exception as e: - if ret['status'] != 1: - raise UserError(e) - else: - raise UserError("分配工厂失败,请联系管理员") + self.cr.rollback() + return UserError('工厂创建销售订单和产品失败,请联系管理员') - # 特征识别 + +# 特征识别 def feature_recognition(self, report_path, model_code): feature_path = self.env['sf.auto_quatotion.common'].sudo().get_feature_full_path() - # price_path = self.env['jikimo.auto_quatotion.common'].get_price_full_path() process_time_db_path = self.env['sf.auto_quatotion.common'].sudo().get_process_time_db_path() ret = self.env['sf.auto_quatotion.common'].sudo().get_auto_quatotion(report_path, feature_path, process_time_db_path, @@ -200,11 +249,10 @@ class QuickEasyOrder(models.Model): return ret # 模型上色 - def model_coloring(self): + def model_coloring(self, order): url = '/api/library_of_models/create' config = self.env['res.config.settings'].get_values() config_header = Common.get_headers(self, config['token'], config['sf_secret_key']) - order = self.search([('id', '=', self.id)]) logging.info('order: %s' % order.name) if order: attachment = order.upload_model_file[0] @@ -252,11 +300,13 @@ class QuickEasyOrder(models.Model): vals['accuracy'] = order.machining_precision vals['number'] = order.quantity vals['process_code'] = 0 - vals['texture_code'] = order.material_model_id.code + vals['texture_code'] = order.material_model_id.materials_no vals['delivery_days'] = 15 if order.model_file: - attachment = self.env['ir.attachment'].sudo().search( - [('id', '=', order.upload_model_file[0])]) + for item in order.upload_model_file: + if item.ids[0]: + logging.info('create-attachment:%s' % int(item.ids[0])) + attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item.ids[0]))]) vals['attachment_id'] = attachment.id else: vals['attachment_id'] = '' diff --git a/sf_sale/views/quick_easy_order_view.xml b/sf_sale/views/quick_easy_order_view.xml index 6c5f263c..cf8a2c9f 100644 --- a/sf_sale/views/quick_easy_order_view.xml +++ b/sf_sale/views/quick_easy_order_view.xml @@ -19,7 +19,7 @@ - + @@ -41,8 +41,8 @@ - - + + diff --git a/web_widget_model_viewer/__manifest__.py b/web_widget_model_viewer/__manifest__.py index 52ed13b1..9cc75c66 100644 --- a/web_widget_model_viewer/__manifest__.py +++ b/web_widget_model_viewer/__manifest__.py @@ -18,5 +18,6 @@ 'web.assets_backend': [ 'web_widget_model_viewer/static/src/js/*', ], - } + }, + 'license': 'LGPL-3', } \ No newline at end of file From 6e6b0b66d332b2bd9844af807ab992387a7589ed Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 29 Aug 2023 10:22:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/base.py | 2 +- sf_base/models/fixture.py | 24 +++++++-------- sf_base/models/functional_fixture.py | 2 +- sf_base/models/tool_base_new.py | 10 +++---- sf_base/security/ir.model.access.csv | 1 + sf_manufacturing/models/model_type.py | 27 ++--------------- sf_manufacturing/models/product_template.py | 33 ++++++++++----------- sf_sale/security/ir.model.access.csv | 1 + 8 files changed, 39 insertions(+), 61 deletions(-) diff --git a/sf_base/models/base.py b/sf_base/models/base.py index 042b77f4..86496959 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -118,7 +118,7 @@ class MachineTool(models.Model): supplier_id = fields.Many2one('res.partner', string='制造商', domain="[('is_vendor', '=', True)]") registration_date = fields.Date('注册日期') - state_zc = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册', tracking=True) + state_zc = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册') active = fields.Boolean('有效', default=True) @api.constrains('rotate_speed') diff --git a/sf_base/models/fixture.py b/sf_base/models/fixture.py index bbaecb7c..daf5f0d8 100644 --- a/sf_base/models/fixture.py +++ b/sf_base/models/fixture.py @@ -34,22 +34,22 @@ class FixtureModel(models.Model): clamping_way = fields.Char(string="装夹方式") port_type = fields.Char(string="接口类型") model_file = fields.Binary(string="3D模型图") - length = fields.Char(string="长度[mm]", size=6) - width = fields.Char(string="宽度[mm]", size=6) - height = fields.Char(string="高度[mm]", size=6) - weight = fields.Char(string="重量[kg]", size=4) - clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX[mm]", size=6) - clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX[mm]", size=6) - clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX[mm]", size=6) - clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX[mm]", size=6) - maximum_carrying_weight = fields.Float(string="最大承载重量[kg]", size=4) - maximum_clamping_force = fields.Integer(string="最大夹持力[n]", size=8) + length = fields.Char(string="长度(mm)") + width = fields.Char(string="宽度(mm)") + height = fields.Char(string="高度(mm)") + weight = fields.Char(string="重量(kg)") + clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)") + clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)") + clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)") + clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径max(mm)") + maximum_carrying_weight = fields.Float(string="最大承载重量(kg)") + maximum_clamping_force = fields.Integer(string="最大夹持力(n)") materials_model_id = fields.Many2one('sf.materials.model', string="材料型号") driving_way = fields.Selection([('气动', '气动'), ('液压', '液压'), ('机械', '机械')], string="驱动方式") apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_fixture_model_machine_tool_type', string="适用机床型号") - through_hole_size = fields.Integer(string="过孔大小[mm]", size=6) - screw_size = fields.Integer(string="螺牙大小[mm]", size=6) + through_hole_size = fields.Integer(string="过孔大小[mm]") + screw_size = fields.Integer(string="螺牙大小[mm]") active = fields.Boolean('有效', default=True) def _get_code(self, fixture_model_type_code): diff --git a/sf_base/models/functional_fixture.py b/sf_base/models/functional_fixture.py index 5a769757..c96466c1 100644 --- a/sf_base/models/functional_fixture.py +++ b/sf_base/models/functional_fixture.py @@ -36,7 +36,7 @@ class FunctionalFixture(models.Model): domain=[('fixture_material_type', '=', '磁吸托盘')]) vice_tray_model_ids = fields.Many2many('sf.fixture.model', 'rel_fixture_model_vice_tray', string="虎钳托盘型号", domain=[('fixture_material_type', '=', '虎钳托盘')]) - registration_status = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册', tracking=True) + registration_status = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册') active = fields.Boolean('有效', default=True) @api.onchange('type_id') diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 2891da17..0a94430e 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -102,11 +102,11 @@ class CuttingToolModel(models.Model): cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='刀具类型', ) brand_id = fields.Many2one('sf.machine.brand', '品牌') - tool_length = fields.Integer('长度(mm)', size=6) - tool_width = fields.Integer('宽度(mm)', size=6) - tool_height = fields.Integer('高度(mm)', size=6) - tool_thickness = fields.Integer('厚度(mm)', size=6) - tool_weight = fields.Float('重量(kg)', size=4) + tool_length = fields.Integer('长度(mm)') + tool_width = fields.Integer('宽度(mm)') + tool_height = fields.Integer('高度(mm)') + tool_thickness = fields.Integer('厚度(mm)') + tool_weight = fields.Float('重量(kg)') coating_material = fields.Char('涂层材质') # 整体式刀具参数 total_length = fields.Float('总长度(mm)') diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 03e2a81b..2cb14006 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -23,6 +23,7 @@ access_sf_multi_mounting_type,sf_multi_mounting_type,model_sf_multi_mounting_typ access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,1,1,1,1 access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1 access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,base.group_user,1,1,1,1 +access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,1 diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py index 075937fd..5c8105dc 100644 --- a/sf_manufacturing/models/model_type.py +++ b/sf_manufacturing/models/model_type.py @@ -32,14 +32,7 @@ class ProductModelTypeRoutingSort(models.Model): sequence = fields.Integer('Sequence') route_workcenter_id = fields.Many2one('mrp.routing.workcenter') is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat') - routing_type = fields.Selection([ - ('获取CNC加工程序', '获取CNC加工程序'), - ('装夹', '装夹'), - ('前置三元定位检测', '前置三元定位检测'), - ('CNC加工', 'CNC加工'), - ('后置三元质量检测', '后置三元质量检测'), - ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺') - ], string="工序类型", related='route_workcenter_id.routing_type') + routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type') workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids') product_model_type_id = fields.Many2one('sf.model.type') @@ -55,14 +48,7 @@ class EmbryoModelTypeRoutingSort(models.Model): sequence = fields.Integer('Sequence') route_workcenter_id = fields.Many2one('mrp.routing.workcenter') is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat') - routing_type = fields.Selection([ - ('获取CNC加工程序', '获取CNC加工程序'), - ('装夹', '装夹'), - ('前置三元定位检测', '前置三元定位检测'), - ('CNC加工', 'CNC加工'), - ('后置三元质量检测', '后置三元质量检测'), - ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺') - ], string="工序类型", related='route_workcenter_id.routing_type') + routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type') workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids') embryo_model_type_id = fields.Many2one('sf.model.type') @@ -78,14 +64,7 @@ class SurfaceTechnicsModelTypeRoutingSort(models.Model): sequence = fields.Integer('Sequence') route_workcenter_id = fields.Many2one('mrp.routing.workcenter') is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat') - routing_type = fields.Selection([ - ('获取CNC加工程序', '获取CNC加工程序'), - ('装夹', '装夹'), - ('前置三元定位检测', '前置三元定位检测'), - ('CNC加工', 'CNC加工'), - ('后置三元质量检测', '后置三元质量检测'), - ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺') - ], string="工序类型", related='route_workcenter_id.routing_type') + routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type') workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids') surface_technics_model_type_id = fields.Many2one('sf.model.type') diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index eac02928..1fc79a96 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -12,11 +12,7 @@ import os class ResProductMo(models.Model): _inherit = 'product.template' model_file = fields.Binary('模型文件') - categ_type = fields.Selection( - [("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"), - ("夹具", "夹具")], - string='产品的类别', related='categ_id.type', - store=True) + categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True) model_name = fields.Char('模型名称') model_long = fields.Float('模型长(mm)', digits=(16, 3)) model_width = fields.Float('模型宽(mm)', digits=(16, 3)) @@ -56,11 +52,11 @@ class ResProductMo(models.Model): domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]") brand_id = fields.Many2one('sf.machine.brand', '品牌') - tool_length = fields.Integer('长度(mm)', size=6) - tool_width = fields.Integer('宽度(mm)', size=6) - tool_height = fields.Integer('高度(mm)', size=6) - tool_thickness = fields.Integer('厚度(mm)', size=6) - tool_weight = fields.Float('重量(kg)', size=4) + tool_length = fields.Integer('长度(mm)') + tool_width = fields.Integer('宽度(mm)') + tool_height = fields.Integer('高度(mm)') + tool_thickness = fields.Integer('厚度(mm)') + tool_weight = fields.Float('重量(kg)') coating_material = fields.Char('涂层材质') # 整体式刀具参数 cutting_tool_total_length = fields.Float('总长度(mm)') @@ -138,17 +134,17 @@ class ResProductMo(models.Model): fixture_clamping_way = fields.Char(string="装夹方式") fixture_port_type = fields.Char(string="接口类型") fixture_model_file = fields.Binary(string="3D模型图") - fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX(mm)", size=6) - fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX(mm)", size=6) - fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX(mm)", size=6) - fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX(mm)", digits=(16, 6)) + fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)") + fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)") + fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)") + fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径max(mm)", digits=(16, 6)) fixture_maximum_carrying_weight = fields.Float(string="最大承载重量(kg)", digits=(16, 4)) - fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)", size=8) + fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)") fixture_driving_way = fields.Char(string="驱动方式") fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type', string="适用机床型号") - fixture_through_hole_size = fields.Integer(string="过孔大小(mm)", size=6) - fixture_screw_size = fields.Integer(string="螺牙大小(mm)", size=6) + fixture_through_hole_size = fields.Integer(string="过孔大小(mm)") + fixture_screw_size = fields.Integer(string="螺牙大小(mm)") # 注册状态 register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'), ('注册失败', '注册失败')], string='注册状态', default='未注册') @@ -368,7 +364,8 @@ class ResProductMo(models.Model): '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_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'], diff --git a/sf_sale/security/ir.model.access.csv b/sf_sale/security/ir.model.access.csv index 9bc8bba0..5a3a2ee8 100644 --- a/sf_sale/security/ir.model.access.csv +++ b/sf_sale/security/ir.model.access.csv @@ -1,5 +1,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_quick_easy_order,quick_easy_order,model_quick_easy_order,base.group_user,1,1,1,1 +access_sf_auto_quatotion_common,sf_auto_quatotion_common,model_sf_auto_quatotion_common,base.group_user,1,1,1,1