Merge remote-tracking branch 'origin/feature/产品添加夹具型号信息' into feature/功能刀具新增字段

# Conflicts:
#	sf_manufacturing/models/product_template.py
This commit is contained in:
yuxianghui
2024-01-09 10:33:16 +08:00
9 changed files with 254 additions and 42 deletions

View File

@@ -473,7 +473,6 @@ class ResProductMo(models.Model):
cutting_tool_dynamic_balance_class = fields.Char('动平衡等级')
cutting_tool_fit_nut_model = fields.Char('适用锁紧螺母型号')
# 夹头参数
cutting_tool_taper = fields.Integer('锥度(°)')
cutting_tool_top_diameter = fields.Float('顶部直径')
@@ -591,34 +590,65 @@ class ResProductMo(models.Model):
if item.fixture_material_id.id != item.fixture_model_id.fixture_material_id.id:
item.fixture_model_id = False
@api.onchange('fixture_model_id')
def _onchange_fixture_model_id(self):
for item in self:
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
item.brand_id = item.fixture_model_id.brand_id.id
item.fixture_model_file = item.fixture_model_id.model_file
item.tool_length = item.fixture_model_id.length
item.tool_width = item.fixture_model_id.width
item.tool_height = item.fixture_model_id.height
item.tool_weight = item.fixture_model_id.weight
item.materials_type_id = item.fixture_model_id.materials_model_id.id
item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
item.fixture_clamping_way = item.fixture_model_id.clamping_way
item.fixture_port_type = item.fixture_model_id.port_type
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
item.fixture_driving_way = item.fixture_model_id.driving_way
if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
item.fixture_screw_size = item.fixture_model_id.screw_size
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
item.fixture_apply_machine_tool_type_ids = self._get_ids(
item.fixture_model_id.apply_machine_tool_type_ids)
#
# @api.onchange('fixture_model_id')
# def _onchange_fixture_model_id(self):
# for item in self:
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
# item.brand_id = item.fixture_model_id.brand_id.id
# item.fixture_model_file = item.fixture_model_id.model_file
# item.tool_length = item.fixture_model_id.length
# item.tool_width = item.fixture_model_id.width
# item.tool_height = item.fixture_model_id.height
# item.tool_weight = item.fixture_model_id.weight
# item.materials_type_id = item.fixture_model_id.materials_model_id.id
# item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
# item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
# if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
# item.fixture_clamping_way = item.fixture_model_id.clamping_way
# item.fixture_port_type = item.fixture_model_id.port_type
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
# item.fixture_driving_way = item.fixture_model_id.driving_way
# if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
# item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
# item.fixture_screw_size = item.fixture_model_id.screw_size
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
# item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
# item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
# item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
# item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
# item.fixture_apply_machine_tool_type_ids = self._get_ids(
# item.fixture_model_id.apply_machine_tool_type_ids)
# @api.onchange('fixture_model_id')
# def _onchange_fixture_model_id(self):
# for item in self:
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
# item.brand_id = item.fixture_model_id.brand_id.id
# item.fixture_multi_mounting_type_id = item.fixture_model_id.multi_mounting_type_id.id
# item.fixture_model_file = item.fixture_model_id.model_file
# item.tool_length = item.fixture_model_id.length
# item.tool_width = item.fixture_model_id.width
# item.tool_height = item.fixture_model_id.height
# item.tool_weight = item.fixture_model_id.weight
# item.materials_type_id = item.fixture_model_id.materials_model_id.id
# item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
# item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
# if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
# item.fixture_clamping_way = item.fixture_model_id.clamping_way
# item.fixture_port_type = item.fixture_model_id.port_type
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
# item.fixture_driving_way = item.fixture_model_id.driving_way
# if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
# item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
# item.fixture_screw_size = item.fixture_model_id.screw_size
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
# item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
# item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
# item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
# item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
# item.fixture_apply_machine_tool_type_ids = self._get_ids(
# item.fixture_model_id.apply_machine_tool_type_ids)
def _get_volume_uom_id_from_ir_config_parameter(self):
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
@@ -869,6 +899,27 @@ class ResProductFixture(models.Model):
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
# =========================待删除字段================================
fixture_multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
fixture_clamping_way = fields.Char(string="装夹方式")
fixture_port_type = fields.Char(string="接口类型")
fixture_model_file = fields.Binary(string="3D模型图")
fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)")
fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)")
fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)")
fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径max(mm)", digits=(16, 6))
fixture_maximum_carrying_weight = fields.Float(string="最大承载重量(kg)", digits=(16, 4))
fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)")
fixture_driving_way = fields.Char(string="驱动方式")
fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type',
string="适用机床型号")
fixture_through_hole_size = fields.Integer(string="过孔大小(mm)")
fixture_screw_size = fields.Integer(string="螺牙大小(mm)")
# ===============================================================
@api.onchange('specification_fixture_id')
def _onchange_specification_fixture_id(self):
if self.specification_fixture_id: