From ed5f47cc3120156844ad96e2ac08fb9ea6dd03ee Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 27 Nov 2023 17:34:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=88=80=E5=85=B7=E6=A0=87?= =?UTF-8?q?=E5=87=86=E5=BA=93=E5=88=80=E7=89=87=E5=BD=A2=E7=8A=B6=EF=BC=8C?= =?UTF-8?q?=E6=9F=84=E9=83=A8=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=8E=8B=E7=B4=A7?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=88=80=E5=B0=96=E7=89=B9=E5=BE=81?= =?UTF-8?q?=EF=BC=8C=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E5=8F=8A=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E6=8E=A7=E4=BB=B6=E6=98=BE=E7=A4=BA=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=A7=E5=93=81=E9=A1=B5=E9=9D=A2=EF=BC=9A=E5=88=80?= =?UTF-8?q?=E7=89=87=E5=BD=A2=E7=8A=B6=EF=BC=8C=E6=9F=84=E9=83=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E5=8E=8B=E7=B4=A7=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=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=8F=8A=E5=AF=B9=E5=BA=94=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/tool_base_new.py | 9 ++++--- sf_base/views/tool_views.xml | 8 +++---- .../product_template_management_view.xml | 2 +- sf_manufacturing/models/product_template.py | 15 +++++------- sf_mrs_connect/controllers/controllers.py | 4 +--- sf_mrs_connect/models/sync_common.py | 24 +++++++------------ sf_tool_management/models/base.py | 6 ++--- .../models/tool_material_search.py | 4 +--- sf_tool_management/views/tool_base_views.xml | 4 ++-- .../views/tool_material_search.xml | 4 ++-- 10 files changed, 32 insertions(+), 48 deletions(-) diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 11af399c..dcf7000c 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -76,21 +76,20 @@ class CuttingToolModel(models.Model): integral_run_out_accuracy_max = fields.Char('整体式刀具端跳精度max') integral_run_out_accuracy_min = fields.Char('整体式刀具端跳精度min') - fit_blade_shape_id = fields.Many2many('maintenance.equipment.image', 'fit_blade_shape_library_rel', + fit_blade_shape_id = fields.Many2one('maintenance.equipment.image', '适配刀片形状', domain=[('type', '=', '刀片形状')]) suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image', 'suitable_machining_method_library_rel', '适合加工方式', domain=[('type', '=', '加工能力')]) - blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image', - 'blade_tip_character_library_rel', + blade_tip_characteristics_id = fields.Many2one('maintenance.equipment.image', '刀尖特征', domain=[('type', '=', '刀尖特征')]) - handle_type_ids = fields.Many2many('maintenance.equipment.image', 'handle_type_library_rel', + handle_type_id = fields.Many2one('maintenance.equipment.image', '柄部类型', domain=[('type', '=', '柄部类型')]) cutting_direction_ids = fields.Many2many('maintenance.equipment.image', 'cutting_direction_library_rel', '走刀方向', domain=[('type', '=', '走刀方向')]) suitable_coolant_ids = fields.Many2many('maintenance.equipment.image', 'suitable_coolant_library_rel', '适合冷却液', domain=[('type', '=', '冷却液')]) - compaction_way_ids = fields.Many2many('maintenance.equipment.image', 'compaction_way_library_rel', + compaction_way_id = fields.Many2one('maintenance.equipment.image', '压紧方式', domain=[('type', '=', '压紧方式')]) integral_tool_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters', 'standard_library_id', string='整体式刀具基本参数') diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index c1e03123..d0f7d649 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -170,7 +170,7 @@ - + @@ -180,15 +180,15 @@ + widget="many2one_radio"/> - + - + diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index 01d40a17..428db02c 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -405,7 +405,7 @@ - + diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 5a079abe..99e0b3e2 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -87,7 +87,7 @@ class ResProductMo(models.Model): cutting_tool_run_out_accuracy_max = fields.Float('端跳精度max', digits=(6, 1)) cutting_tool_run_out_accuracy_min = fields.Float('端跳精度min', digits=(6, 1)) cutting_tool_blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20) - fit_blade_shape_id = fields.Many2many('maintenance.equipment.image', 'rel_fit_blade_shape_product_template', + fit_blade_shape_id = fields.Many2one('maintenance.equipment.image', '适配刀片形状', domain=[('type', '=', '刀片形状')]) suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image', 'rel_machining_product_template', '适合加工方式', @@ -95,8 +95,7 @@ class ResProductMo(models.Model): blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image', 'rel_blade_tip_product_template', '刀尖特征', domain=[('type', '=', '刀尖特征')]) - handle_type_ids = fields.Many2many('maintenance.equipment.image', 'rel_handle_product_template', '柄部类型', - domain=[('type', '=', '柄部类型')]) + handle_type_id = fields.Many2one('maintenance.equipment.image', '柄部类型',domain=[('type', '=', '柄部类型')]) cutting_direction_ids = fields.Many2many('maintenance.equipment.image', 'rel_cutting_product_template', '走刀方向', domain=[('type', '=', '走刀方向')]) suitable_coolant_ids = fields.Many2many('maintenance.equipment.image', 'rel_coolant_product_template', @@ -141,7 +140,7 @@ class ResProductMo(models.Model): item.fit_blade_shape_id = False item.suitable_machining_method_ids = False item.blade_tip_characteristics_id = False - item.handle_type_ids = False + item.handle_type_id = False item.cutting_direction_ids = False item.suitable_coolant_ids = False item.compaction_way_ids = False @@ -292,9 +291,7 @@ class ResProductMo(models.Model): self.cutting_tool_model_id.blade_tip_characteristics_id \ else [(6, 0, self.cutting_tool_model_id.blade_tip_characteristics_id.ids)] - self.handle_type_ids = [(6, 0, - [])] if not self.cutting_tool_model_id.handle_type_ids else [ - (6, 0, self.cutting_tool_model_id.handle_type_ids.ids)] + self.handle_type_id = self.cutting_tool_model_id.handle_type_id self.cutting_direction_ids = [(6, 0, [])] if not self.cutting_tool_model_id.cutting_direction_ids else [ @@ -346,7 +343,7 @@ class ResProductMo(models.Model): self.feed_per_tooth_ids = False @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') + 'handle_type_id', '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 ['刀片', '刀杆', '刀盘']: @@ -359,7 +356,7 @@ class ResProductMo(models.Model): if not self.suitable_coolant_ids: raise ValidationError("请选择适合冷却液") elif self.cutting_tool_type == '整体式刀具': - if not self.handle_type_ids: + if not self.handle_type_id: raise ValidationError("请选择柄部类型") if not self.suitable_coolant_ids: raise ValidationError("请选择适合冷却液") diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 1d21f4f1..a6a1b25f 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- +import logging import json import base64 -import logging -import os -from datetime import date, timedelta from odoo import http from odoo.http import request diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 7439c87b..22231646 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1820,15 +1820,13 @@ class Cutting_tool_standard_library(models.Model): "cutter_pad_ids": [(6, 0, [])] if not item.get('cutter_pad_codes') else self.env[ 'sf.cutting_tool.standard.library']._get_ids(item['cutter_pad_codes'], result['factory_short_name']), - "fit_blade_shape_id": [(6, 0, [])] if not item.get('fit_blade_shape') else self.env[ - 'maintenance.equipment.image']._get_ids(item['fit_blade_shape']), + "fit_blade_shape_id": item.get('fit_blade_shape') , "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), "blade_tip_characteristics_id": [(6, 0, [])] if not item.get('blade_tip_characteristics') else self.env['maintenance.equipment.image']._get_ids(item['blade_tip_characteristics']), - "handle_type_ids": [(6, 0, [])] if not item.get('handle_type') else self.env[ - 'maintenance.equipment.image']._get_ids(item['handle_type']), + "handle_type_id": item.get('handle_type'), "cutting_direction_ids": [(6, 0, [])] if not item.get('cutting_direction') else self.env[ 'maintenance.equipment.image']._get_ids(item['cutting_direction']), "suitable_coolant_ids": [(6, 0, [])] if not item.get('suitable_coolant') else self.env[ @@ -1868,15 +1866,13 @@ class Cutting_tool_standard_library(models.Model): "cutter_pad_ids": [(6, 0, [])] if not item.get('cutter_pad_codes') else self.env[ 'sf.cutting_tool.standard.library']._get_ids(item['cutter_pad_codes'], result['factory_short_name']), - "fit_blade_shape_id": [(6, 0, [])] if not item.get('fit_blade_shape') else self.env[ - 'maintenance.equipment.image']._get_ids(item['fit_blade_shape']), + "fit_blade_shape_id": item.get('fit_blade_shape'), "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), "blade_tip_characteristics_id": [(6, 0, [])] if not item.get('blade_tip_characteristics') else self.env['maintenance.equipment.image']._get_ids(item['blade_tip_characteristics']), - "handle_type_ids": [(6, 0, [])] if not item.get('handle_type') else self.env[ - 'maintenance.equipment.image']._get_ids(item['handle_type']), + "handle_type_id":item.get('handle_type'), "cutting_direction_ids": [(6, 0, [])] if not item.get('cutting_direction') else self.env[ 'maintenance.equipment.image']._get_ids(item['cutting_direction']), "suitable_coolant_ids": [(6, 0, [])] if not item.get('suitable_coolant') else self.env[ @@ -1985,15 +1981,13 @@ class Cutting_tool_standard_library(models.Model): "cutter_pad_ids": [(6, 0, [])] if not item.get('cutter_pad_codes') else self.env[ 'sf.cutting_tool.standard.library']._get_ids(item['cutter_pad_codes'], result['factory_short_name']), - "fit_blade_shape_id": [(6, 0, [])] if not item.get('fit_blade_shape') else self.env[ - 'maintenance.equipment.image']._get_ids(item['fit_blade_shape']), + "fit_blade_shape_id": item.get('fit_blade_shape'), "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_method') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_method']), "blade_tip_characteristics_id": [(6, 0, [])] if not item.get('blade_tip_characteristics') else self.env['maintenance.equipment.image']._get_ids(item['blade_tip_characteristics']), - "handle_type_ids": [(6, 0, [])] if not item.get('handle_type') else self.env[ - 'maintenance.equipment.image']._get_ids(item['handle_type']), + "handle_type_id": item.get('handle_type'), "cutting_direction_ids": [(6, 0, [])] if not item.get('cutting_direction') else self.env[ 'maintenance.equipment.image']._get_ids(item['cutting_direction']), "suitable_coolant_ids": [(6, 0, [])] if not item.get('suitable_coolant') else self.env[ @@ -2033,15 +2027,13 @@ class Cutting_tool_standard_library(models.Model): "cutter_pad_ids": [(6, 0, [])] if not item.get('cutter_pad_codes') else self.env[ 'sf.cutting_tool.standard.library']._get_ids(item['cutter_pad_codes'], result['factory_short_name']), - "fit_blade_shape_id": [(6, 0, [])] if not item.get('fit_blade_shape') else self.env[ - 'maintenance.equipment.image']._get_ids(item['fit_blade_shape']), + "fit_blade_shape_id": item.get('fit_blade_shape'), "suitable_machining_method_ids": [(6, 0, [])] if not item.get( 'suitable_machining_methods') else self.env['maintenance.equipment.image']._get_ids( item['suitable_machining_methods']), "blade_tip_characteristics_id": [(6, 0, [])] if not item.get('blade_tip_characteristics') else self.env['maintenance.equipment.image']._get_ids(item['blade_tip_characteristics']), - "handle_type_ids": [(6, 0, [])] if not item.get('handle_type') else self.env[ - 'maintenance.equipment.image']._get_ids(item['handle_type']), + "handle_type_id": item.get('handle_type'), "cutting_direction_ids": [(6, 0, [])] if not item.get('cutting_direction') else self.env[ 'maintenance.equipment.image']._get_ids(item['cutting_direction']), "suitable_coolant_ids": [(6, 0, [])] if not item.get('suitable_coolant') else self.env[ diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 7402632f..c8c090a6 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -89,9 +89,9 @@ class FunctionalCuttingToolEntity(models.Model): blade_tip_characteristics_id = fields.Many2many( 'maintenance.equipment.image', 'rel_blade_tip_product_template_tool_entity', '刀尖特征', domain=[('type', '=', '刀尖特征')], related='cutting_tool_integral_model_id.blade_tip_characteristics_id') - handle_type_ids = fields.Many2many( - 'maintenance.equipment.image', 'rel_handle_product_template_tool_entity', '柄部类型', - domain=[('type', '=', '柄部类型')], related='cutting_tool_integral_model_id.handle_type_ids') + handle_type_id = fields.Many2one( + 'maintenance.equipment.image', '柄部类型', + domain=[('type', '=', '柄部类型')], related='cutting_tool_integral_model_id.handle_type_id') cutting_direction_ids = fields.Many2many( 'maintenance.equipment.image', 'rel_cutting_product_template_tool_entity', '走刀方向', domain=[('type', '=', '走刀方向')], related='cutting_tool_integral_model_id.cutting_direction_ids') diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index b89b76cd..3c9180fc 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -102,9 +102,7 @@ class SfToolMaterialSearch(models.Model): blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image', 'rel_blade_tip_product_template_material_search', '刀尖特征', domain=[('type', '=', '刀尖特征')]) - handle_type_ids = fields.Many2many('maintenance.equipment.image', - 'rel_handle_product_template_material_search', '柄部类型', - domain=[('type', '=', '柄部类型')]) + handle_type_id = fields.Many2many('maintenance.equipment.image', '柄部类型',domain=[('type', '=', '柄部类型')]) cutting_direction_ids = fields.Many2many('maintenance.equipment.image', 'rel_cutting_product_template_material_search', '走刀方向', domain=[('type', '=', '走刀方向')]) diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 674c9faf..8a4713e1 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -110,8 +110,8 @@ domain="[('id','in',blade_tip_characteristics_id)]"/> - + diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 768786e6..3bb5d3ea 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -231,10 +231,10 @@ - + - +