|
|
|
|
@@ -151,33 +151,35 @@ class ResProductMo(models.Model):
|
|
|
|
|
item.cutting_speed_ids = False
|
|
|
|
|
item.feed_per_tooth_ids = False
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
if self.cutting_tool_type == '整体式刀具':
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
|
|
|
|
elif self.cutting_tool_type == '刀片':
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
|
|
|
|
elif self.cutting_tool_type == '刀杆':
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
|
|
|
|
elif self.cutting_tool_type == '刀盘':
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
elif self.cutting_tool_type == '刀柄':
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
else:
|
|
|
|
|
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
return {
|
|
|
|
|
'name': _('规格'),
|
|
|
|
|
'view_mode': 'list',
|
|
|
|
|
'view_id': tree_view.id,
|
|
|
|
|
'type': 'ir.actions.act_window',
|
|
|
|
|
'res_model': 'sf.tool.materials.basic.parameters',
|
|
|
|
|
'target': 'new',
|
|
|
|
|
'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
|
|
|
|
('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
|
|
|
|
}
|
|
|
|
|
# def choice(self):
|
|
|
|
|
# if self.cutting_tool_type == '整体式刀具':
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
|
|
|
|
# elif self.cutting_tool_type == '刀片':
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
|
|
|
|
# elif self.cutting_tool_type == '刀杆':
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
|
|
|
|
# elif self.cutting_tool_type == '刀盘':
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
# elif self.cutting_tool_type == '刀柄':
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
# else:
|
|
|
|
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
|
|
|
|
# return {
|
|
|
|
|
# 'name': _('规格'),
|
|
|
|
|
# 'view_mode': 'list',
|
|
|
|
|
# 'view_id': tree_view.id,
|
|
|
|
|
# 'type': 'ir.actions.act_window',
|
|
|
|
|
# 'res_model': 'sf.tool.materials.basic.parameters',
|
|
|
|
|
# 'target': 'new',
|
|
|
|
|
# 'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
|
|
|
|
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
@api.onchange('specification_id')
|
|
|
|
|
def _onchange_specification(self):
|
|
|
|
|
if self.specification_id:
|
|
|
|
|
self.cutting_speed_ids = False
|
|
|
|
|
self.feed_per_tooth_ids = False
|
|
|
|
|
self.cutting_tool_type_id = self.cutting_tool_model_id.cutting_tool_type_id.id
|
|
|
|
|
self.brand_id = self.cutting_tool_model_id.brand_id.id
|
|
|
|
|
self.tool_hardness = self.cutting_tool_model_id.tool_hardness
|
|
|
|
|
@@ -202,14 +204,18 @@ class ResProductMo(models.Model):
|
|
|
|
|
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
|
|
|
|
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
|
|
|
|
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
|
|
|
|
self.feed_per_tooth_ids = [(0, 0, {'product_template_id': product_template.id,
|
|
|
|
|
'cutting_speed': product_template.cutting_speed,
|
|
|
|
|
'machining_method': product_template.machining_method,
|
|
|
|
|
'blade_diameter': product_template.blade_diameter,
|
|
|
|
|
'materials_type_id': product_template.materials_type_id.id}) for
|
|
|
|
|
product_template in
|
|
|
|
|
self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
|
|
|
|
lambda r: r.blade_diameter == self.specification_id.blade_diameter)]
|
|
|
|
|
# # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.
|
|
|
|
|
# for tooth in self.cutting_tool_model_id.feed_per_tooth_ids:
|
|
|
|
|
# print(int(tooth.blade_diameter))
|
|
|
|
|
# print(int(self.specification_id.blade_diameter))
|
|
|
|
|
# if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter):
|
|
|
|
|
# self.feed_per_tooth_ids = [(0, 0, {
|
|
|
|
|
# 'cutting_speed': tooth.cutting_speed,
|
|
|
|
|
# 'machining_method': tooth.machining_method,
|
|
|
|
|
# 'blade_diameter': tooth.blade_diameter,
|
|
|
|
|
# 'materials_type_id': tooth.materials_type_id.id})]
|
|
|
|
|
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
|
|
|
|
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
|
|
|
|
elif self.cutting_tool_type == '夹头':
|
|
|
|
|
self.cutting_tool_clamping_length = self.specification_id.clamping_length
|
|
|
|
|
self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance
|
|
|
|
|
@@ -284,8 +290,8 @@ class ResProductMo(models.Model):
|
|
|
|
|
elif self.cutting_tool_type == '刀柄':
|
|
|
|
|
self.cutting_tool_total_length = self.specification_id.total_length
|
|
|
|
|
self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed
|
|
|
|
|
self.cutting_tool_speed_max = self.specification_id.speed_max
|
|
|
|
|
self.cutting_tool_change_time = self.specification_id.change_time
|
|
|
|
|
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
|
|
|
|
|
self.cutting_tool_change_time = self.specification_id.tool_changing_time
|
|
|
|
|
self.cutting_tool_total_length = self.specification_id.total_length
|
|
|
|
|
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
|
|
|
|
|
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
|
|
|
|
|
@@ -313,6 +319,44 @@ class ResProductMo(models.Model):
|
|
|
|
|
self.compaction_way_ids = [(6, 0,
|
|
|
|
|
[])] if not self.cutting_tool_model_id.compaction_way_ids else [
|
|
|
|
|
(6, 0, self.cutting_tool_model_id.compaction_way_ids.ids)]
|
|
|
|
|
else:
|
|
|
|
|
self.cutting_tool_type_id = False
|
|
|
|
|
self.brand_id = False
|
|
|
|
|
self.tool_hardness = False
|
|
|
|
|
self.cutting_tool_run_out_accuracy_max = False
|
|
|
|
|
self.cutting_tool_run_out_accuracy_min = False
|
|
|
|
|
self.materials_type_id = False
|
|
|
|
|
self.cutting_tool_blade_type = False
|
|
|
|
|
self.cutting_tool_total_length = False
|
|
|
|
|
self.cutting_tool_clamping_way = False
|
|
|
|
|
self.cutting_tool_blade_diameter = False
|
|
|
|
|
self.cutting_tool_shank_length = False
|
|
|
|
|
self.cutting_tool_blade_length = False
|
|
|
|
|
self.cutting_tool_blade_number = False
|
|
|
|
|
self.cutting_tool_neck_length = False
|
|
|
|
|
self.cutting_tool_neck_diameter = False
|
|
|
|
|
self.cutting_tool_shank_diameter = False
|
|
|
|
|
self.cutting_tool_blade_tip_diameter = False
|
|
|
|
|
self.cutting_tool_blade_tip_taper = False
|
|
|
|
|
self.cutting_tool_blade_helix_angle = False
|
|
|
|
|
self.cutting_tool_blade_type = False
|
|
|
|
|
self.cutting_tool_pitch = False
|
|
|
|
|
self.cutting_tool_blade_width = False
|
|
|
|
|
self.cutting_tool_blade_depth = False
|
|
|
|
|
self.cutting_tool_cut_depth = False
|
|
|
|
|
self.cutting_tool_coarse_medium_fine = False
|
|
|
|
|
self.cutting_tool_run_out_accuracy_max = False
|
|
|
|
|
self.cutting_tool_run_out_accuracy_min = False
|
|
|
|
|
self.cutting_tool_blade_tip_working_size = False
|
|
|
|
|
self.fit_blade_shape_id = False
|
|
|
|
|
self.suitable_machining_method_ids = False
|
|
|
|
|
self.blade_tip_characteristics_id = False
|
|
|
|
|
self.handle_type_ids = False
|
|
|
|
|
self.cutting_direction_ids = False
|
|
|
|
|
self.suitable_coolant_ids = False
|
|
|
|
|
self.compaction_way_ids = False
|
|
|
|
|
self.cutting_speed_ids = False
|
|
|
|
|
self.feed_per_tooth_ids = False
|
|
|
|
|
|
|
|
|
|
# @api.constrains('suitable_machining_method_ids')
|
|
|
|
|
# def _check_suitable_machining_method_ids(self):
|
|
|
|
|
@@ -899,7 +943,8 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|
|
|
|
_description = '机床刀位'
|
|
|
|
|
|
|
|
|
|
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
|
|
|
|
product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
|
|
|
|
|
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('直径')
|
|
|
|
|
@@ -911,5 +956,3 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|
|
|
|
alarm_value = fields.Char('报警值')
|
|
|
|
|
used_value = fields.Char('已使用值')
|
|
|
|
|
code = fields.Char('机床刀位号')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|