diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py
index 90574f2b..b6e764e4 100644
--- a/sf_maintenance/models/sf_maintenance.py
+++ b/sf_maintenance/models/sf_maintenance.py
@@ -36,6 +36,7 @@ class SfMaintenanceEquipment(models.Model):
num = "%04d" % m
return num
+
equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards',
'sf_maintenance_equipment_ids', string='设备维保标准')
eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准',
diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml
index 258dfb34..fe9a35e3 100644
--- a/sf_maintenance/views/maintenance_views.xml
+++ b/sf_maintenance/views/maintenance_views.xml
@@ -73,105 +73,105 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
-
-
-
+
+
+
-
-
-
+
-
-
-
+
+
+
-
-
-
+
@@ -184,54 +184,54 @@
-
-
-
-
-
-
-
m/S
-
m/S
-
m/S
-
mm
@@ -242,26 +242,26 @@
-
mm
-
mm
-
°
-
mm
@@ -275,14 +275,14 @@
-
kg
-
kg
@@ -290,7 +290,7 @@
-
h
@@ -298,7 +298,7 @@
-
@@ -326,7 +326,7 @@
-
kw
@@ -334,7 +334,7 @@
-
i
@@ -342,7 +342,7 @@
-
kw
@@ -354,14 +354,14 @@
-
kw
-
i
@@ -369,7 +369,7 @@
-
kw
@@ -377,7 +377,7 @@
-
i
@@ -393,27 +393,27 @@
-
-
-
-
@@ -426,19 +426,19 @@
-
-
-
@@ -448,14 +448,14 @@
-
°
-
°
@@ -470,15 +470,15 @@
-
mm
-
mm
-
mm
@@ -487,25 +487,25 @@
-
mm
-
kg
-
kg
-
mm
@@ -526,15 +526,15 @@
-
mm
-
mm
-
mm
@@ -545,22 +545,22 @@
options="{'format': false}"/>
-
-
-
°
-
°
@@ -575,30 +575,30 @@
-
mm
-
mm
-
mm
-
mm
-
mm
-
mm
@@ -606,19 +606,19 @@
-
μm
-
-
@@ -627,19 +627,19 @@
-
kg
-
kg
-
mm
@@ -656,13 +656,13 @@
-
-
@@ -671,19 +671,19 @@
-
倍
-
倍
-
mm
@@ -692,23 +692,23 @@
-
-
最小
-
mm~
-
mm
@@ -717,19 +717,19 @@
-
°
-
°
-
@@ -737,7 +737,7 @@
-
+
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index febab313..e2be4958 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -23,6 +23,7 @@
'views/mrp_workorder_view.xml',
'views/tool_other_features_view.xml',
'views/model_type_view.xml',
+ 'views/sf_maintenance_equipment.xml',
# 'views/kanban_change.xml'
],
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index baf86eb6..ae4ccd53 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -835,3 +835,43 @@ class ResMrpBomMo(models.Model):
raw_bom = self.env['product.product'].search(
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)])
return raw_bom
+
+
+class SfMaintenanceEquipmentAndProductTemplate(models.Model):
+ _inherit = 'maintenance.equipment'
+ _description = '设备'
+ product_template_ids = fields.One2many('maintenance.equipment.tool', 'equipment_id', string='机床刀位')
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ vals = []
+ for value in vals_list:
+ res = super(SfMaintenanceEquipmentAndProductTemplate, self).create(value)
+ number = value.get('number_of_knife_library')
+ for i in range(1, number + 1):
+ self.env['maintenance.equipment.tool'].create({
+ 'equipment_id': res.id,
+ 'code': 'T' + str(i)
+ })
+ vals.append(res)
+ return vals[0]
+
+
+class SfMaintenanceEquipmentTool(models.Model):
+ _name = 'maintenance.equipment.tool'
+ _description = '机床刀位'
+
+ equipment_id = fields.Many2one('maintenance.equipment', string='设备')
+ product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
+ image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
+ categ_type = fields.Char(string='功能刀具类型')
+ diameter = fields.Char('直径')
+ precision = fields.Char('粗\中\精')
+ tool_code = fields.Char('功能刀具编码')
+ hilt_name = fields.Char('刀柄名称')
+ hilt_code = fields.Char('刀柄编码')
+ life_value_max = fields.Char('最大寿命值')
+ alarm_value = fields.Char('报警值')
+ used_value = fields.Char('已使用值')
+ code = fields.Char('机床刀位号')
+
diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv
index 76812adb..66de9496 100644
--- a/sf_manufacturing/security/ir.model.access.csv
+++ b/sf_manufacturing/security/ir.model.access.csv
@@ -14,5 +14,6 @@ access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base
access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
+access_maintenance_equipment_tool,maintenance_equipment_tool,model_maintenance_equipment_tool,base.group_user,1,1,1,1
diff --git a/sf_manufacturing/views/sf_maintenance_equipment.xml b/sf_manufacturing/views/sf_maintenance_equipment.xml
new file mode 100644
index 00000000..f072967b
--- /dev/null
+++ b/sf_manufacturing/views/sf_maintenance_equipment.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ sf_equipment.form
+ maintenance.equipment
+
+
+
+
+
+
+
+
+
+ sf.maintenance.logs.tree
+ sf.maintenance.logs
+
+
+
+
+
+
+
+
+
+ sf_manufacturing_equipment.form
+ maintenance.equipment
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file