diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index 21f4d41d..2c05e1a2 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -19,6 +19,8 @@ "views/menu_view.xml", "views/tool_base_views.xml", "views/tool_base_menu.xml", + 'views/fixture_base_view.xml', + 'views/menu_fixture_view.xml', ], 'demo': [ diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index f6e247d2..5b9136ae 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -1,5 +1,6 @@ from . import base from . import common from . import tool_base +from . import fixture_base diff --git a/sf_base/models/base.py b/sf_base/models/base.py index 4c77c114..aeb0c0ac 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -304,33 +304,6 @@ class MachineToolType(models.Model): code = fields.Char('编码') -# 刀具 -class CuttingTool(models.Model): - _name = 'sf.cutting_tool.category' - _description = '刀具类别' - code = fields.Char('编码') - name = fields.Char('名称') - remark = fields.Text('备注') - active = fields.Boolean('有效', default=True) - - -class CuttingToolType(models.Model): - _name = 'sf.cutting_tool.type' - _description = '刀具型号' - code = fields.Char('编码') - name = fields.Char('名称') - diameter = fields.Integer('直径') - long_blade = fields.Integer('避空长/刃长') - cone_angle_pitch = fields.Integer('锥角/节距') - shank_diameter = fields.Integer('柄径') - taper_shank_length = fields.Integer('锥柄长') - tool_length = fields.Integer('刀具总长') - blade_number = fields.Integer('刃数') - category_id = fields.Many2one('sf.cutting_tool.category', string='刀具类别') - brand_id = fields.Many2one('sf.machine.brand', string='品牌') - remark = fields.Text('备注') - active = fields.Boolean('有效', default=True) - class MachineToolCategory(models.Model): _name = 'sf.machine_tool.category' _description = '机床类型' diff --git a/sf_base/models/fixture_base.py b/sf_base/models/fixture_base.py new file mode 100644 index 00000000..6ca48f71 --- /dev/null +++ b/sf_base/models/fixture_base.py @@ -0,0 +1,240 @@ +from odoo import models, fields + +'''============================定位元件型号=====================================''' + + +class FixtureSettingElement(models.Model): + _name = 'sf.fixture.setting.element' + _description = "定位元件型号" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="型号名称", readonly=True) + setting_ele_type_id = fields.Many2one('sf.setting.element.type', string="定位元件类型", readonly=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True) + + length = fields.Char(string='长度(mm)', readonly=True) + width = fields.Char(string='宽度(mm)', readonly=True) + height = fields.Char(string='高度(mm)', readonly=True) + diameter = fields.Char(string='直径(mm)', readonly=True) + + material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True) + hardness = fields.Char(string='硬度(°)', readonly=True) + chucking_power = fields.Char(string='夹持力', readonly=True) + surface_treatment = fields.Char(string='表面处理', readonly=True) + accuracy_grade = fields.Char(string='精度等级', readonly=True) + + picture = fields.Binary(string="图片", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''=============================定位原件类型=============================================''' + + +class SettingElementType(models.Model): + _name = 'sf.setting.element.type' + _description = "定位原件类型" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string='定位原件类型', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''==============================夹紧元件型号==============================================''' + + +class FixtureClampingElement(models.Model): + _name = 'sf.fixture.clamping.element' + _description = "夹紧元件型号" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="型号名称", readonly=True) + clamping_ele_type_id = fields.Many2one('sf.clamping.element.type', string="夹紧元件类型", readonly=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True) + + length = fields.Char(string='长度(mm)', readonly=True) + width = fields.Char(string='宽度(mm)', readonly=True) + height = fields.Char(string='高度(mm)', readonly=True) + diameter = fields.Char(string='直径(mm)', readonly=True) + + material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True) + hardness = fields.Char(string='硬度(°)', readonly=True) + chucking_power = fields.Char(string='夹持力', readonly=True) + surface_treatment = fields.Char(string='夹持方式', readonly=True) + accuracy_grade = fields.Char(string='精度等级', readonly=True) + + picture = fields.Binary(string="图片", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''============================夹紧元件类型=======================================''' + + +# 夹紧元件类型 +class ClampingElementType(models.Model): + _name = "sf.clamping.element.type" + _description = "夹紧元件类型" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(name='夹紧元件类型', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''=========================对刀夹具型号=====================================''' + + +class FixtureToolSetting(models.Model): + _name = 'sf.fixture.tool.setting' + _description = "对刀夹具型号" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="型号名称", readonly=True) + tool_setting_type_id = fields.Many2one('sf.tool.setting.type', string="对刀夹具类型", readonly=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True) + + length = fields.Char(string='长度(mm)', readonly=True) + width = fields.Char(string='宽度(mm)', readonly=True) + height = fields.Char(string='高度(mm)', readonly=True) + diameter = fields.Char(string='直径(mm)', readonly=True) + + material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True) + hardness = fields.Char(string='硬度(°)', readonly=True) + chucking_power = fields.Char(string='夹持力', readonly=True) + clamp_mode = fields.Char(string='夹持方式', readonly=True) + accuracy_grade = fields.Char(string='精度等级', readonly=True) + max_clamp_diameter = fields.Char('最大夹持直接(mm)', readonly=True) + + picture = fields.Binary(string="图片", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''===========================对刀夹具类型==========================================''' + + +class ToolSettingType(models.Model): + _name = 'sf.tool.setting.type' + _description = "对刀夹具类型" + + code = fields.Char('编码', readonly=True) + name = fields.Char(string='对刀夹具类型', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''==========================定位装置型号=======================================''' + + +class FixtureLocatingDevice(models.Model): + _name = 'sf.fixture.locating.device' + _description = "定位装置型号" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="型号名称", readonly=True) + locating_device_type_id = fields.Many2one('sf.locating.device.type', string="定位装置类型", readonly=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True) + + length = fields.Char(string='长度(mm)', readonly=True) + width = fields.Char(string='宽度(mm)', readonly=True) + height = fields.Char(string='高度(mm)', readonly=True) + diameter = fields.Char(string='直径(mm)', readonly=True) + + material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True) + weight = fields.Char(string='重量(kg)', readonly=True) + accuracy_grade = fields.Char(string='精度等级', readonly=True) + locate_mode_ids = fields.Many2many('sf.locating.device.locate.mode', string='定位装置定位方式', readonly=True) + max_bearing_capacity = fields.Char(string='最大承载力', readonly=True) + + picture = fields.Binary(string="图片", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''==============================定位装置类型================================''' + + +# 定位装置型号 +class LocatingDeviceType(models.Model): + _name = 'sf.locating.device.type' + _description = "定位装置类型" + + code = fields.Char('编码', readonly=True) + name = fields.Char(string='定位装置类型', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''============================定位装置定位方式========================================''' + + +# 定位装置定位方式 +class LocatingDeviceLocateMode(models.Model): + _name = 'sf.locating.device.locate.mode' + _description = "定位装置定位方式" + + code = fields.Char('编码', readonly=True) + name = fields.Char('定位方式', readonly=True) + name_id = fields.Many2many('sf.fixture.locating.device', string='定位装置', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''===========================导向元件型号====================================''' + + +class FixtureGuideElement(models.Model): + _name = 'sf.fixture.guide.element' + _description = "导向元件型号" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="型号名称", readonly=True) + guide_ele_type_id = fields.Many2one('sf.guide.element.type', string="导向元件类型", readonly=True) + brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True) + + length = fields.Char(string='长度(mm)', readonly=True) + width = fields.Char(string='宽度(mm)', readonly=True) + height = fields.Char(string='高度(mm)', readonly=True) + diameter = fields.Char(string='直径(mm)', readonly=True) + + material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True) + weight = fields.Char(string='重量', readonly=True) + accuracy_grade = fields.Char(string='精度等级', readonly=True) + guide_ele_guide_mode_id = fields.Many2many('sf.guide.element.guide.mode', string='导向元件导向方式', readonly=True) + scope_of_application = fields.Char(string='适用范围', readonly=True) + guide_ele_way_to_install_id = fields.Many2many('sf.guide.element.way.to.install', string='导向元件安装方式', + readonly=True) + + picture = fields.Binary(string="图片", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''=============================导向元件类型============================================''' + + +class GuideElementType(models.Model): + _name = 'sf.guide.element.type' + _description = "导向元件类型" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="导向元件类型", readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''================================导向元件导向方式==========================================''' + + +class GuideElementGuideMode(models.Model): + _name = 'sf.guide.element.guide.mode' + _description = "导向元件导向方式" + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="导向元件导向方式", readonly=True) + name_id = fields.Many2many('sf.fixture.guide.element', string='导向元件', readonly=True) + comment = fields.Text(string='备注', readonly=True) + + +'''=============================导向元件安装方式===========================================''' + + +class GuideElementWayToInstall(models.Model): + _name = 'sf.guide.element.way.to.install' + _description = '导向元件安装方式' + + code = fields.Char(string='编码', readonly=True) + name = fields.Char(string="导向元件安装方式", readonly=True) + name_id = fields.Many2many('sf.fixture.guide.element', string='导向元件', readonly=True) + comment = fields.Text(string='备注', readonly=True) diff --git a/sf_base/models/tool_base.py b/sf_base/models/tool_base.py index b41a1075..33426cd4 100644 --- a/sf_base/models/tool_base.py +++ b/sf_base/models/tool_base.py @@ -7,6 +7,16 @@ from odoo.exceptions import UserError from datetime import datetime +# 功能刀具物料 +class CuttingToolMaterial(models.Model): + _name = 'sf.cutting.tool.material' + _description = '刀具物料' + + code = fields.Char('编码') + name = fields.Char('名称') + remark = fields.Char('备注') + + # 功能刀具 class FunctionalCuttingTool(models.Model): _name = 'sf.functional.cutting.tool' @@ -53,6 +63,8 @@ class IntegralCuttingTool(models.Model): code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 整体式刀具类型字段,关联整体式刀具类型对象 integral_model_number = fields.Many2one('sf.integral.cutting.tool.model', '整体式刀具类型') # 增加品牌、总长度(mm)、柄部长度(mm)、刃部长度(mm)、直径(mm)、刃数、前角(°)、后角(°)、主偏角(°)、材料型号、配对螺母(mm)、适用夹头型号、适用范围、图片、创建人、创建时间等字段 @@ -80,6 +92,8 @@ class IntegralCuttingToolModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') remark = fields.Text('备注') @@ -90,10 +104,12 @@ class Blade(models.Model): code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 刀片类型字段,关联刀片类型对象 blade_model_number = fields.Many2one('sf.blade.model', '刀片类型') # 编码、型号名称、刀片类型、品牌、长度L(mm)、宽度D(mm)、高度T(mm)、顶角(°)、前角(°)、后角(°)、主偏角(°)、R角(°)、材料型号、加工硬度、配对螺母(mm)、适用刀杆/刀盘型号、刀尖半径(mm)、图片、创建人、创建时间字段 - brand = fields.Many2one('sf.machine.brand', '品牌',) + brand = fields.Many2one('sf.machine.brand', '品牌', ) length = fields.Float('长度L(mm)') width = fields.Float('宽度D(mm)') height = fields.Float('高度T(mm)') @@ -120,6 +136,8 @@ class BladeModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 刀片类型字段,关联刀片对象 blade_ids = fields.One2many('sf.blade', 'blade_model_number', '刀片类型') remark = fields.Text('备注') @@ -132,6 +150,8 @@ class CutterBar(models.Model): code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 刀杆类型字段,关联刀杆类型对象 cutter_bar_model_number = fields.Many2one('sf.cutter.bar.model', '刀杆类型') # 品牌、C柄径(mm)、L总长(mm)、材料型号、刃数、D刃径(mm)、适用刀片型号、配对扳手(mm)、配备螺丝(mm)、刀尖圆角半径、精度等级、硬度(°)、适用范围、图片、创建人、创建时间 @@ -158,6 +178,8 @@ class CutterBarModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') remark = fields.Text('备注') @@ -168,6 +190,8 @@ class CutterPad(models.Model): code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 刀盘类型字段,关联刀盘类型对象 cutter_pad_model_number = fields.Many2one('sf.cutter.pad.model', '刀盘类型') # 增加品牌、C柄径(mm)、L总长(mm)、材料型号、刃数、D刃径(mm)、适用刀片型号、配对扳手(mm)、配备螺丝(mm)、刀尖圆角半径、精度等级、硬度(°)、适用范围、图片、创建人、创建时间 @@ -194,6 +218,8 @@ class CutterPadModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') remark = fields.Text('备注') @@ -204,6 +230,8 @@ class Handle(models.Model): code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 刀柄类型字段,关联刀柄类型对象 handle_model_number = fields.Many2one('sf.handle.model', '刀柄类型') # 增加、刀柄类型、品牌、L(mm)、L1(mm)、D1(mm)、重量(kg)、材料型号、本体精度(mm)、配对螺母(mm)、适用夹头型号、夹持范围(mm)、检测精度、检测硬度、标准转速、图片、创建人、创建时间 @@ -230,6 +258,8 @@ class HandleModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') remark = fields.Text('备注') @@ -237,9 +267,12 @@ class HandleModel(models.Model): class Chuck(models.Model): _name = 'sf.chuck' _description = '夹头' + _rec_name = 'code' code = fields.Char('编码') name = fields.Char('型号名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') # 夹头类型字段,关联夹头类型对象 chuck_model_number = fields.Many2one('sf.chuck.model', '夹头类型') # 增加品牌、精度(mm)、外径(mm)、内径(mm)、高度(mm)、材料型号、配对螺母(mm)、适用刀柄型号、夹持范围(mm)、特性、图片、创建人、创建时间 @@ -263,5 +296,6 @@ class ChuckModel(models.Model): code = fields.Char('编码') name = fields.Char('名称') + # 关联刀具物料 + cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料') remark = fields.Text('备注') - diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index b75eee63..ad1e2ff2 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -1,8 +1,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_sf_machine_tool,sf_machine_tool,model_sf_machine_tool,base.group_user,1,1,1,1 -access_sf_cutting_tool_category,sf_cutting_tool_category,model_sf_cutting_tool_category,base.group_user,1,1,1,1 access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,base.group_user,1,1,1,1 -access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,base.group_user,1,1,1,1 access_sf_machine_brand,sf_machine_brand,model_sf_machine_brand,base.group_user,1,1,1,1 access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,base.group_user,1,1,1,1 access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,base.group_user,1,1,1,1 @@ -31,8 +29,20 @@ access_sf_handle,sf.handle,model_sf_handle,base.group_user,1,1,1,1 access_sf_handle_model,sf.handle.model,model_sf_handle_model,base.group_user,1,1,1,1 access_sf_chuck,sf.chuck,model_sf_chuck,base.group_user,1,1,1,1 access_sf_chuck_model,sf.chuck.model,model_sf_chuck_model,base.group_user,1,1,1,1 - - - +access_sf_cutting_tool_material,sf.cutting.tool.material,model_sf_cutting_tool_material,base.group_user,1,1,1,1 + +access_sf_fixture_setting_element,sf_fixture_setting_element,model_sf_fixture_setting_element,base.group_user,1,1,1,1 +access_sf_setting_element_type,sf_setting_element_type,model_sf_setting_element_type,base.group_user,1,1,1,1 +access_sf_fixture_clamping_element,sf_fixture_clamping_element,model_sf_fixture_clamping_element,base.group_user,1,1,1,1 +access_sf_clamping_element_type,sf_clamping_element_type,model_sf_clamping_element_type,base.group_user,1,1,1,1 +access_sf_fixture_tool_setting,sf_fixture_tool_setting,model_sf_fixture_tool_setting,base.group_user,1,1,1,1 +access_sf_tool_setting_type,sf_tool_setting_type,model_sf_tool_setting_type,base.group_user,1,1,1,1 +access_sf_fixture_locating_device,sf_fixture_locating_device,model_sf_fixture_locating_device,base.group_user,1,1,1,1 +access_sf_locating_device_type,sf_locating_device_type,model_sf_locating_device_type,base.group_user,1,1,1,1 +access_sf_locating_device_locate_mode,sf_locating_device_locate_mode,model_sf_locating_device_locate_mode,base.group_user,1,1,1,1 +access_sf_fixture_guide_element,sf_fixture_guide_element,model_sf_fixture_guide_element,base.group_user,1,1,1,1 +access_sf_guide_element_type,sf_guide_element_type,model_sf_guide_element_type,base.group_user,1,1,1,1 +access_sf_guide_element_guide_mode,sf_guide_element_guide_mode,model_sf_guide_element_guide_mode,base.group_user,1,1,1,1 +access_sf_guide_element_way_to_install,sf_guide_element_way_to_install,model_sf_guide_element_way_to_install,base.group_user,1,1,1,1 diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml index 7aa192c1..75d481c8 100644 --- a/sf_base/views/base_view.xml +++ b/sf_base/views/base_view.xml @@ -255,156 +255,6 @@
- #------------------刀具型号------------------ - -- [刀具型号] 还没有哦!点左上角的[创建]按钮,沙发归你了! -
--
-- [刀具类别] 还没有哦!点左上角的[创建]按钮,沙发归你了! -
--
-