From c8129478d58e9f7c910335b5c040eead342823b7 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Mon, 4 Sep 2023 17:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E5=B7=A5=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E3=80=81=E5=88=80=E5=B0=96=E7=89=B9=E5=BE=81=E3=80=81?= =?UTF-8?q?=E6=9F=84=E9=83=A8=E7=B1=BB=E5=9E=8B=E3=80=81=E8=B5=B0=E5=88=80?= =?UTF-8?q?=E6=96=B9=E5=90=91=E3=80=81=E9=80=82=E5=90=88=E5=86=B7=E5=8D=B4?= =?UTF-8?q?=E6=B6=B2=E4=BA=94=E4=B8=AA=E6=A8=A1=E5=9E=8B=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=EF=BC=9B=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E8=BF=B0=E4=BA=94=E4=B8=AA=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=AF=B9=E8=B1=A1=EF=BC=9B=E5=AF=B9=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E7=9A=84=E6=95=B4=E4=BD=93=E5=BC=8F=E5=88=80=E5=85=B7=E7=89=A9?= =?UTF-8?q?=E6=96=99=E8=83=BD=E5=8A=9B=E5=8F=82=E6=95=B0=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__manifest__.py | 1 + sf_base/models/__init__.py | 1 + sf_base/models/tool_other_features.py | 41 +++++++ sf_base/security/ir.model.access.csv | 5 + sf_base/views/tool_other_features_view.xml | 101 ++++++++++++++++++ sf_dlm/views/product_template_view.xml | 99 +++++++++++++---- .../models/tool_material_search.py | 42 ++++++++ .../views/tool_material_search.xml | 16 +++ 8 files changed, 286 insertions(+), 20 deletions(-) create mode 100644 sf_base/models/tool_other_features.py create mode 100644 sf_base/views/tool_other_features_view.xml diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index bcb25c81..5f4c6906 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -18,6 +18,7 @@ 'views/common_view.xml', 'views/fixture_view.xml', 'views/functional_fixture_view.xml', + 'views/tool_other_features_view.xml', 'views/menu_view.xml', "views/tool_views.xml", "views/tool_menu.xml", diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 483787eb..93961162 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -3,6 +3,7 @@ from . import common from . import tool_base_new from . import fixture from . import functional_fixture +from . import tool_other_features diff --git a/sf_base/models/tool_other_features.py b/sf_base/models/tool_other_features.py new file mode 100644 index 00000000..52acf25c --- /dev/null +++ b/sf_base/models/tool_other_features.py @@ -0,0 +1,41 @@ +from odoo import fields, models + + +class SuitableMachiningMethod(models.Model): + _name = 'sf.suitable.machining.method' + _description = '适合加工方式' + + name = fields.Char('名称') + image = fields.Image('图片') + + +class BladeTipCharacteristics(models.Model): + _name = 'sf.blade.tip.characteristics' + _description = '刀尖特征' + + name = fields.Char('名称') + image = fields.Image('图片') + + +class HandleType(models.Model): + _name = 'sf.handle.type' + _description = '柄部类型' + + name = fields.Char('名称') + image = fields.Image('图片') + + +class CuttingDirection(models.Model): + _name = 'sf.cutting.direction' + _description = '走刀方向' + + name = fields.Char('名称') + image = fields.Image('图片') + + +class SuitableCoolant(models.Model): + _name = 'sf.suitable.coolant' + _description = '适合冷却液' + + name = fields.Char('名称') + image = fields.Image('图片') \ No newline at end of file diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 2cb14006..ba3fb3d0 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -24,6 +24,11 @@ access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user, 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 +access_sf_suitable_machining_method,sf_suitable_machining_method,model_sf_suitable_machining_method,base.group_user,1,1,1,1 +access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_tip_characteristics,base.group_user,1,1,1,1 +access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1 +access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1 +access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1 diff --git a/sf_base/views/tool_other_features_view.xml b/sf_base/views/tool_other_features_view.xml new file mode 100644 index 00000000..e094a376 --- /dev/null +++ b/sf_base/views/tool_other_features_view.xml @@ -0,0 +1,101 @@ + + + + + 适合加工方式 + sf.suitable.machining.method + + + + + + + + + + 适合加工方式 + ir.actions.act_window + sf.suitable.machining.method + tree + + + + + + 刀尖特征 + sf.blade.tip.characteristics + + + + + + + + + + 刀尖特征 + ir.actions.act_window + sf.blade.tip.characteristics + tree + + + + + + 柄部类型 + sf.handle.type + + + + + + + + + + 柄部类型 + ir.actions.act_window + sf.handle.type + tree + + + + + + 走刀方向 + sf.cutting.direction + + + + + + + + + + 走刀方向 + ir.actions.act_window + sf.cutting.direction + tree + + + + + + 适合冷却液 + sf.suitable.coolant + + + + + + + + + + 适合冷却液 + ir.actions.act_window + sf.suitable.coolant + tree + + \ No newline at end of file diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml index 10eef5d6..bfe1e4d5 100644 --- a/sf_dlm/views/product_template_view.xml +++ b/sf_dlm/views/product_template_view.xml @@ -83,18 +83,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (mm) + + + (mm) + + + + + + + + + + + + + + + + + + + - - - - + + + - - + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀柄'))]}"/> + + + + @@ -111,11 +170,11 @@ options="{'format': false}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片','刀杆','刀盘'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片','刀杆','刀盘'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘','刀柄'))]}"/> @@ -152,24 +211,24 @@ + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> - + attrs="{'invisible': [('cutting_tool_type', 'in', ('刀柄', '整体式刀具'))]}"/> + + attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/> diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index dac651e1..f75d7e08 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -94,6 +94,48 @@ class SfToolMaterialSearch(models.Model): integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1)) integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1)) + suitable_machining_method_ids = fields.Many2many('sf.suitable.machining.method', + 'rel_suitable_machining_method', '适合加工方式') + blade_tip_characteristics_ids = fields.Many2many('sf.blade.tip.characteristics', + 'rel_blade_tip_characteristics', '刀尖特征') + handle_type_ids = fields.Many2many('sf.handle.type', 'rel_handle_type', '柄部类型') + cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction', '走刀方向') + suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant', '适合冷却液') + + @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('integral_total_length') def _check_integral_total_length(self): if self.integral_total_length <= 0 and self.cutting_tool_type == '整体式刀具': diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 0e1c5b0b..4bb4bf03 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -188,6 +188,7 @@ + @@ -223,6 +224,21 @@ + + + + + + + + + + + + + + +