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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + - - + 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 @@ + + + + + + + + + + + + + + +