Merge remote-tracking branch 'origin/feature/产品添加夹具型号信息' into feature/功能刀具新增字段
# Conflicts: # sf_manufacturing/models/product_template.py
This commit is contained in:
@@ -241,3 +241,12 @@ class MaintenanceStandardImage(models.Model):
|
|||||||
else:
|
else:
|
||||||
record['image'] = ""
|
record['image'] = ""
|
||||||
return records
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
class ToolGroups(models.Model):
|
||||||
|
_name = 'sf.tool.groups'
|
||||||
|
_description = '刀具组'
|
||||||
|
|
||||||
|
name = fields.Char('名称')
|
||||||
|
equipment_ids = fields.Many2many('maintenance.equipment', 'ref_maintenance_equipment', string='机台号')
|
||||||
|
remark = fields.Char('备注', size=50)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,
|
|||||||
access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1
|
access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1
|
||||||
access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1
|
access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1
|
||||||
access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,base.group_user,1,1,1,1
|
access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,base.group_user,1,1,1,1
|
||||||
|
access_sf_tool_groups,sf_tool_groups,model_sf_tool_groups,base.group_user,1,1,1,1
|
||||||
access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,base.group_user,1,1,1,1
|
access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,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_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_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
|
||||||
|
|||||||
|
@@ -92,5 +92,12 @@
|
|||||||
action="action_maintenance_equipment_image"
|
action="action_maintenance_equipment_image"
|
||||||
sequence="5"/>
|
sequence="5"/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="menu_sf_tool_groups"
|
||||||
|
name="刀具组"
|
||||||
|
parent="menu_sf_cutting_tool"
|
||||||
|
action="sf_tool_groups_view_act"
|
||||||
|
sequence="10"/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -490,6 +490,28 @@
|
|||||||
<field name="domain">[]</field>
|
<field name="domain">[]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- ================================================刀具组================================================ -->
|
||||||
|
<record id="sf_tool_groups_tree" model="ir.ui.view">
|
||||||
|
<field name="name">刀具组</field>
|
||||||
|
<field name="model">sf.tool.groups</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree create="1" edit="1" delete="1" editable="bottom">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="equipment_ids" widget="many2many_tags"/>
|
||||||
|
<field name="remark"/>
|
||||||
|
<field name="create_uid" string="创建人"/>
|
||||||
|
<field name="create_date" string="创建时间"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_tool_groups_view_act" model="ir.actions.act_window">
|
||||||
|
<field name="name">刀具组</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">sf.tool.groups</field>
|
||||||
|
<field name="view_mode">tree,form,search</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- ================================================刀具基础参数================================================ -->
|
<!-- ================================================刀具基础参数================================================ -->
|
||||||
<!-- <record id="view_sf_tool_materials_basic_parameters_tree" model="ir.ui.view">-->
|
<!-- <record id="view_sf_tool_materials_basic_parameters_tree" model="ir.ui.view">-->
|
||||||
<!-- <field name="name">sf.tool.materials.basic.parameters.tree</field>-->
|
<!-- <field name="name">sf.tool.materials.basic.parameters.tree</field>-->
|
||||||
|
|||||||
@@ -473,7 +473,6 @@ class ResProductMo(models.Model):
|
|||||||
cutting_tool_dynamic_balance_class = fields.Char('动平衡等级')
|
cutting_tool_dynamic_balance_class = fields.Char('动平衡等级')
|
||||||
cutting_tool_fit_nut_model = fields.Char('适用锁紧螺母型号')
|
cutting_tool_fit_nut_model = fields.Char('适用锁紧螺母型号')
|
||||||
|
|
||||||
|
|
||||||
# 夹头参数
|
# 夹头参数
|
||||||
cutting_tool_taper = fields.Integer('锥度(°)')
|
cutting_tool_taper = fields.Integer('锥度(°)')
|
||||||
cutting_tool_top_diameter = fields.Float('顶部直径')
|
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:
|
if item.fixture_material_id.id != item.fixture_model_id.fixture_material_id.id:
|
||||||
item.fixture_model_id = False
|
item.fixture_model_id = False
|
||||||
|
|
||||||
@api.onchange('fixture_model_id')
|
#
|
||||||
def _onchange_fixture_model_id(self):
|
# @api.onchange('fixture_model_id')
|
||||||
for item in self:
|
# def _onchange_fixture_model_id(self):
|
||||||
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
|
# for item in self:
|
||||||
item.brand_id = item.fixture_model_id.brand_id.id
|
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
|
||||||
item.fixture_model_file = item.fixture_model_id.model_file
|
# item.brand_id = item.fixture_model_id.brand_id.id
|
||||||
item.tool_length = item.fixture_model_id.length
|
# item.fixture_model_file = item.fixture_model_id.model_file
|
||||||
item.tool_width = item.fixture_model_id.width
|
# item.tool_length = item.fixture_model_id.length
|
||||||
item.tool_height = item.fixture_model_id.height
|
# item.tool_width = item.fixture_model_id.width
|
||||||
item.tool_weight = item.fixture_model_id.weight
|
# item.tool_height = item.fixture_model_id.height
|
||||||
item.materials_type_id = item.fixture_model_id.materials_model_id.id
|
# item.tool_weight = item.fixture_model_id.weight
|
||||||
item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
|
# item.materials_type_id = item.fixture_model_id.materials_model_id.id
|
||||||
item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
|
# item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
|
||||||
if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
|
# item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
|
||||||
item.fixture_clamping_way = item.fixture_model_id.clamping_way
|
# if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
|
||||||
item.fixture_port_type = item.fixture_model_id.port_type
|
# item.fixture_clamping_way = item.fixture_model_id.clamping_way
|
||||||
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
|
# item.fixture_port_type = item.fixture_model_id.port_type
|
||||||
item.fixture_driving_way = item.fixture_model_id.driving_way
|
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
|
||||||
if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
|
# item.fixture_driving_way = item.fixture_model_id.driving_way
|
||||||
item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
|
# if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
|
||||||
item.fixture_screw_size = item.fixture_model_id.screw_size
|
# item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
|
||||||
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
|
# item.fixture_screw_size = item.fixture_model_id.screw_size
|
||||||
item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
|
# if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
|
||||||
item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
|
# item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
|
||||||
item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
|
# item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
|
||||||
item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
|
# item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
|
||||||
item.fixture_apply_machine_tool_type_ids = self._get_ids(
|
# item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
|
||||||
item.fixture_model_id.apply_machine_tool_type_ids)
|
# 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):
|
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')
|
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))
|
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
|
||||||
centering_diameter = 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')
|
@api.onchange('specification_fixture_id')
|
||||||
def _onchange_specification_fixture_id(self):
|
def _onchange_specification_fixture_id(self):
|
||||||
if self.specification_fixture_id:
|
if self.specification_fixture_id:
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
_name = 'sf.functional.cutting.tool.entity'
|
_name = 'sf.functional.cutting.tool.entity'
|
||||||
_description = '功能刀具列表'
|
_description = '功能刀具列表'
|
||||||
|
|
||||||
# code = fields.Char('序列号')
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||||
|
code = fields.Char('编码', related='functional_tool_name_id.code')
|
||||||
name = fields.Char(related='functional_tool_name_id.name')
|
name = fields.Char(related='functional_tool_name_id.name')
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
|
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
||||||
@@ -175,6 +176,8 @@ class FunctionalToolWarning(models.Model):
|
|||||||
_name = 'sf.functional.tool.warning'
|
_name = 'sf.functional.tool.warning'
|
||||||
_description = '功能刀具预警'
|
_description = '功能刀具预警'
|
||||||
|
|
||||||
|
code = fields.Char('编码', related='functional_tool_name_id.code')
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||||
name = fields.Char('名称', invisible=True, readonly=True, related='functional_tool_name_id.name')
|
name = fields.Char('名称', invisible=True, readonly=True, related='functional_tool_name_id.name')
|
||||||
# 机床信息
|
# 机床信息
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线',
|
production_line_id = fields.Many2one('sf.production.line', string='生产线',
|
||||||
@@ -243,6 +246,8 @@ class StockMoveLine(models.Model):
|
|||||||
diameter = fields.Integer(string='刀具直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
|
diameter = fields.Integer(string='刀具直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
|
||||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
|
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
|
||||||
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
|
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
|
||||||
|
code = fields.Char('编码', related='functional_tool_name_id.code')
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_functional_tool_type_id(self, categories, domain, order):
|
def _read_group_functional_tool_type_id(self, categories, domain, order):
|
||||||
@@ -254,7 +259,8 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
_name = 'sf.real.time.distribution.of.functional.tools'
|
_name = 'sf.real.time.distribution.of.functional.tools'
|
||||||
_description = '功能刀具安全库存'
|
_description = '功能刀具安全库存'
|
||||||
|
|
||||||
name = fields.Char('功能刀具名称', readonly=False)
|
name = fields.Char('功能刀具名称', readonly=True, compute='_compute_name')
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=False, required=True)
|
||||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
|
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
|
||||||
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
|
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
|
||||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
||||||
@@ -297,6 +303,14 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref',
|
sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref',
|
||||||
'功能刀具组装单', readonly=True)
|
'功能刀具组装单', readonly=True)
|
||||||
|
|
||||||
|
@api.depends('tool_groups_id', 'diameter', 'knife_tip_r_angle')
|
||||||
|
def _compute_name(self):
|
||||||
|
for obj in self:
|
||||||
|
if obj.tool_groups_id:
|
||||||
|
obj.name = '%s-D%sR%s' % (obj.tool_groups_id.name, obj.diameter, obj.knife_tip_r_angle)
|
||||||
|
else:
|
||||||
|
obj.name = None
|
||||||
|
|
||||||
@api.constrains('min_stock_num', 'max_stock_num')
|
@api.constrains('min_stock_num', 'max_stock_num')
|
||||||
def _check_stock_num(self):
|
def _check_stock_num(self):
|
||||||
for obj in self:
|
for obj in self:
|
||||||
@@ -341,6 +355,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
functional_tool_assembly = tool.env['sf.functional.tool.assembly'].sudo().create({
|
functional_tool_assembly = tool.env['sf.functional.tool.assembly'].sudo().create({
|
||||||
'functional_tool_name': tool.name,
|
'functional_tool_name': tool.name,
|
||||||
'functional_tool_type_id': tool.sf_cutting_tool_type_id.id,
|
'functional_tool_type_id': tool.sf_cutting_tool_type_id.id,
|
||||||
|
'tool_groups_id': tool.tool_groups_id.id,
|
||||||
'functional_tool_diameter': tool.diameter,
|
'functional_tool_diameter': tool.diameter,
|
||||||
'knife_tip_r_angle': tool.knife_tip_r_angle,
|
'knife_tip_r_angle': tool.knife_tip_r_angle,
|
||||||
'coarse_middle_thin': tool.coarse_middle_thin,
|
'coarse_middle_thin': tool.coarse_middle_thin,
|
||||||
@@ -421,6 +436,8 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
|
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
|
||||||
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
||||||
# 功能刀具信息
|
# 功能刀具信息
|
||||||
|
code = fields.Char('编码', related='functional_tool_name_id.code')
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||||
functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True)
|
functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True)
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', store=True,
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', store=True,
|
||||||
domain=[('product_id.name', '=', '功能刀具')],
|
domain=[('product_id.name', '=', '功能刀具')],
|
||||||
@@ -677,8 +694,10 @@ class FunctionalToolAssembly(models.Model):
|
|||||||
for obj in self:
|
for obj in self:
|
||||||
obj.name = obj.after_assembly_functional_tool_name
|
obj.name = obj.after_assembly_functional_tool_name
|
||||||
|
|
||||||
|
code = fields.Char('功能刀具编码', readonly=True)
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
|
||||||
name = fields.Char(string='名称', readonly=True, compute='_compute_name')
|
name = fields.Char(string='名称', readonly=True, compute='_compute_name')
|
||||||
assembly_order_code = fields.Char(string='编码', readonly=True)
|
assembly_order_code = fields.Char(string='组装单编码', readonly=True)
|
||||||
|
|
||||||
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
|
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
|
||||||
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<field name="barcode_id"/>
|
<field name="barcode_id"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="functional_tool_name_id"/>
|
||||||
<field name="image" widget='image'/>
|
<field name="image" widget='image'/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="functional_tool_diameter"/>
|
<field name="functional_tool_diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="coarse_middle_thin" optional="hide"/>
|
<field name="coarse_middle_thin" optional="hide"/>
|
||||||
@@ -80,9 +81,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
|
<field name="code" readonly="1"/>
|
||||||
<field name="functional_tool_name_id" invisible="False"
|
<field name="functional_tool_name_id" invisible="False"
|
||||||
placeholder="请输入20字以内的名称"/>
|
placeholder="请输入20字以内的名称"/>
|
||||||
<field name="sf_cutting_tool_type_id"/>
|
<field name="sf_cutting_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="cutting_tool_integral_model_id"
|
<field name="cutting_tool_integral_model_id"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"
|
options="{'no_create': True, 'no_quick_create': True}"
|
||||||
attrs="{'invisible': [('cutting_tool_blade_model_id', '!=', False)]}"
|
attrs="{'invisible': [('cutting_tool_blade_model_id', '!=', False)]}"
|
||||||
@@ -287,6 +290,7 @@
|
|||||||
<tree create="1" edit="1" delete="0">
|
<tree create="1" edit="1" delete="0">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="coarse_middle_thin"/>
|
<field name="coarse_middle_thin"/>
|
||||||
@@ -310,7 +314,7 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<h1>
|
<h1>
|
||||||
<field name="name" attrs="{'readonly': [('status_create', '=', False)]}"/>
|
<field name="name"/>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<field name="status_create" invisible="1"/>
|
<field name="status_create" invisible="1"/>
|
||||||
@@ -318,6 +322,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="sf_cutting_tool_type_id"
|
<field name="sf_cutting_tool_type_id"
|
||||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||||
|
<field name="tool_groups_id"
|
||||||
|
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||||
<field name="diameter"
|
<field name="diameter"
|
||||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||||
<field name="knife_tip_r_angle"
|
<field name="knife_tip_r_angle"
|
||||||
@@ -487,11 +493,13 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree create="0" delete="0">
|
<tree create="0" delete="0">
|
||||||
<field name="name" invisible="1"/>
|
<field name="name" invisible="1"/>
|
||||||
|
<field name="code" invisible="1"/>
|
||||||
<field name="production_line_id" invisible="1"/>
|
<field name="production_line_id" invisible="1"/>
|
||||||
<field name="maintenance_equipment_id" invisible="1"/>
|
<field name="maintenance_equipment_id" invisible="1"/>
|
||||||
<field name="machine_tool_code"/>
|
<field name="machine_tool_code"/>
|
||||||
<field name="cutter_spacing_code_id"/>
|
<field name="cutter_spacing_code_id"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="functional_tool_name_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="max_lifetime_value"/>
|
<field name="max_lifetime_value"/>
|
||||||
@@ -513,6 +521,8 @@
|
|||||||
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
||||||
type="action"
|
type="action"
|
||||||
context="{ 'default_name':name,
|
context="{ 'default_name':name,
|
||||||
|
'default_code':code,
|
||||||
|
'default_tool_groups_id':tool_groups_id,
|
||||||
'default_production_line_id': production_line_id,
|
'default_production_line_id': production_line_id,
|
||||||
'default_maintenance_equipment_id': maintenance_equipment_id,
|
'default_maintenance_equipment_id': maintenance_equipment_id,
|
||||||
'default_machine_table_type_id': machine_table_type_id,
|
'default_machine_table_type_id': machine_table_type_id,
|
||||||
@@ -548,6 +558,8 @@
|
|||||||
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
|
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
|
||||||
type="action"
|
type="action"
|
||||||
context="{ 'default_name':name,
|
context="{ 'default_name':name,
|
||||||
|
'default_code':code,
|
||||||
|
'default_tool_groups_id':tool_groups_id,
|
||||||
'default_production_line_id': production_line_id,
|
'default_production_line_id': production_line_id,
|
||||||
'default_maintenance_equipment_id': maintenance_equipment_id,
|
'default_maintenance_equipment_id': maintenance_equipment_id,
|
||||||
'default_machine_table_type_id': machine_table_type_id,
|
'default_machine_table_type_id': machine_table_type_id,
|
||||||
@@ -587,6 +599,8 @@
|
|||||||
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
||||||
type="action"
|
type="action"
|
||||||
context="{ 'default_name':name,
|
context="{ 'default_name':name,
|
||||||
|
'default_code':code,
|
||||||
|
'default_tool_groups_id':tool_groups_id,
|
||||||
'default_production_line_id': production_line_id,
|
'default_production_line_id': production_line_id,
|
||||||
'default_maintenance_equipment_id': maintenance_equipment_id,
|
'default_maintenance_equipment_id': maintenance_equipment_id,
|
||||||
'default_machine_table_type_id': machine_table_type_id,
|
'default_machine_table_type_id': machine_table_type_id,
|
||||||
@@ -673,9 +687,11 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id"/>
|
<field name="barcode_id"/>
|
||||||
|
<field name="code"/>
|
||||||
<field name="functional_tool_name_id"
|
<field name="functional_tool_name_id"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="functional_tool_type_id"/>
|
<field name="functional_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
</group>
|
</group>
|
||||||
@@ -856,7 +872,9 @@
|
|||||||
<tree create="0" delete="0">
|
<tree create="0" delete="0">
|
||||||
<field name="assembly_order_code"/>
|
<field name="assembly_order_code"/>
|
||||||
<field name="barcode_id" optional="hide"/>
|
<field name="barcode_id" optional="hide"/>
|
||||||
|
<field name="code" optional="hide"/>
|
||||||
<field name="functional_tool_name"/>
|
<field name="functional_tool_name"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="functional_tool_diameter" string="刀具直径"/>
|
<field name="functional_tool_diameter" string="刀具直径"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="coarse_middle_thin" optional="hide"/>
|
<field name="coarse_middle_thin" optional="hide"/>
|
||||||
@@ -890,6 +908,7 @@
|
|||||||
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
||||||
'default_functional_tool_name':functional_tool_name,
|
'default_functional_tool_name':functional_tool_name,
|
||||||
'default_functional_tool_type_id':functional_tool_type_id,
|
'default_functional_tool_type_id':functional_tool_type_id,
|
||||||
|
'default_tool_groups_id': tool_groups_id,
|
||||||
'default_functional_tool_diameter':functional_tool_diameter,
|
'default_functional_tool_diameter':functional_tool_diameter,
|
||||||
'default_knife_tip_r_angle':knife_tip_r_angle,
|
'default_knife_tip_r_angle':knife_tip_r_angle,
|
||||||
'default_tool_loading_length':tool_loading_length,
|
'default_tool_loading_length':tool_loading_length,
|
||||||
@@ -926,6 +945,7 @@
|
|||||||
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
||||||
'default_functional_tool_name':functional_tool_name,
|
'default_functional_tool_name':functional_tool_name,
|
||||||
'default_functional_tool_type_id':functional_tool_type_id,
|
'default_functional_tool_type_id':functional_tool_type_id,
|
||||||
|
'default_tool_groups_id': tool_groups_id,
|
||||||
'default_functional_tool_diameter':functional_tool_diameter,
|
'default_functional_tool_diameter':functional_tool_diameter,
|
||||||
'default_knife_tip_r_angle':knife_tip_r_angle,
|
'default_knife_tip_r_angle':knife_tip_r_angle,
|
||||||
'default_tool_loading_length':tool_loading_length,
|
'default_tool_loading_length':tool_loading_length,
|
||||||
@@ -976,17 +996,22 @@
|
|||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id"/>
|
<field name="barcode_id"/>
|
||||||
|
<field name="code"/>
|
||||||
<field name="after_assembly_functional_tool_name"
|
<field name="after_assembly_functional_tool_name"
|
||||||
string="功能刀具名称"/>
|
string="功能刀具名称"/>
|
||||||
<field name="after_assembly_functional_tool_type_id"
|
<field name="after_assembly_functional_tool_type_id"
|
||||||
string="功能刀具类型"/>
|
string="功能刀具类型"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="after_assembly_functional_tool_diameter"
|
<field name="after_assembly_functional_tool_diameter"
|
||||||
string="刀具直径(mm)"/>
|
string="刀具直径(mm)"/>
|
||||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||||
<field name="after_assembly_new_former" string="新/旧"/>
|
<field name="after_assembly_new_former" string="新/旧"/>
|
||||||
<field name="cut_time"/>
|
<field name="cut_time"
|
||||||
<field name="cut_length"/>
|
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||||
<field name="cut_number"/>
|
<field name="cut_length"
|
||||||
|
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||||
|
<field name="cut_number"
|
||||||
|
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="after_assembly_whether_standard_knife"
|
<field name="after_assembly_whether_standard_knife"
|
||||||
@@ -1102,6 +1127,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="functional_tool_name"/>
|
<field name="functional_tool_name"/>
|
||||||
<field name="functional_tool_type_id"/>
|
<field name="functional_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="tool_loading_length" string="总长度(mm)"/>
|
<field name="tool_loading_length" string="总长度(mm)"/>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
_name = 'sf.tool.change.requirement.information'
|
_name = 'sf.tool.change.requirement.information'
|
||||||
_description = '换刀需求信息'
|
_description = '换刀需求信息'
|
||||||
|
|
||||||
|
code = fields.Char('编码', readonly=True)
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
|
||||||
name = fields.Char('名称', related='maintenance_equipment_id.name', store=True, readonly=True)
|
name = fields.Char('名称', related='maintenance_equipment_id.name', store=True, readonly=True)
|
||||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True)
|
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True)
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True)
|
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True)
|
||||||
@@ -32,7 +34,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||||
|
|
||||||
# 待换功能刀具信息
|
# 待换功能刀具信息
|
||||||
replacement_tool_name = fields.Char(string='待换功能刀具名称', required=True)
|
replacement_tool_name = fields.Char(string='待换功能刀具名称', compute='_compute_name')
|
||||||
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
|
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
|
||||||
replacement_diameter = fields.Integer(string='待换刀具直径(mm)')
|
replacement_diameter = fields.Integer(string='待换刀具直径(mm)')
|
||||||
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', requride=True)
|
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', requride=True)
|
||||||
@@ -52,6 +54,16 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
applicant = fields.Char(string='申请人', default=lambda self: self.env.user.name, readonly=True)
|
applicant = fields.Char(string='申请人', default=lambda self: self.env.user.name, readonly=True)
|
||||||
reason_for_applying = fields.Char(string='申请原因')
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
|
|
||||||
|
@api.depends('replacement_diameter', 'replacement_knife_tip_r_angle', 'tool_groups_id')
|
||||||
|
def _compute_name(self):
|
||||||
|
for obj in self:
|
||||||
|
if obj.tool_groups_id:
|
||||||
|
obj.replacement_tool_name = '%s-D%sR%s' % (
|
||||||
|
obj.tool_groups_id.name, obj.replacement_diameter,
|
||||||
|
obj.replacement_knife_tip_r_angle)
|
||||||
|
else:
|
||||||
|
obj.replacement_tool_name = None
|
||||||
|
|
||||||
@api.constrains('replacement_knife_tip_r_angle', 'replacement_diameter', 'replacement_tool_coarse_middle_thin',
|
@api.constrains('replacement_knife_tip_r_angle', 'replacement_diameter', 'replacement_tool_coarse_middle_thin',
|
||||||
'new_former')
|
'new_former')
|
||||||
def _check_length_or_diamenter(self):
|
def _check_length_or_diamenter(self):
|
||||||
@@ -90,6 +102,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
|||||||
# 功能刀具组装创建新任务(new_assembly_task)
|
# 功能刀具组装创建新任务(new_assembly_task)
|
||||||
sf_functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
|
sf_functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
|
||||||
'functional_tool_name': self.replacement_tool_name,
|
'functional_tool_name': self.replacement_tool_name,
|
||||||
|
'tool_groups_id': self.tool_groups_id.id,
|
||||||
'functional_tool_type_id': self.replacement_tool_type_id.id,
|
'functional_tool_type_id': self.replacement_tool_type_id.id,
|
||||||
'functional_tool_diameter': self.replacement_diameter,
|
'functional_tool_diameter': self.replacement_diameter,
|
||||||
'knife_tip_r_angle': self.replacement_knife_tip_r_angle,
|
'knife_tip_r_angle': self.replacement_knife_tip_r_angle,
|
||||||
@@ -175,7 +188,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
_inherit = ["barcodes.barcode_events_mixin"]
|
_inherit = ["barcodes.barcode_events_mixin"]
|
||||||
_description = '功能刀具组装单'
|
_description = '功能刀具组装单'
|
||||||
|
|
||||||
assembly_order_code = fields.Char(string='编码', readonly=True)
|
assembly_order_code = fields.Char(string='组装单编码', readonly=True)
|
||||||
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
|
||||||
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
|
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
|
||||||
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
@@ -307,7 +321,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
|
|
||||||
# 组装功能刀具参数信息
|
# 组装功能刀具参数信息
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
||||||
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', required=True)
|
tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_tool_code')
|
||||||
|
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', compute='_compute_name')
|
||||||
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
||||||
string='组装后功能刀具类型',
|
string='组装后功能刀具类型',
|
||||||
compute='_compute_after_assembly_functional_tool_type_id')
|
compute='_compute_after_assembly_functional_tool_type_id')
|
||||||
@@ -331,6 +346,58 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
hiding_length = fields.Float(string='避空长(mm)')
|
hiding_length = fields.Float(string='避空长(mm)')
|
||||||
|
|
||||||
# functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
|
# functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
|
||||||
|
# res_partner_id = fields.Many2one('res.partner', '智能工厂', domain="[('is_factory', '=', True)]")
|
||||||
|
|
||||||
|
@api.depends('after_assembly_functional_tool_type_id', 'integral_specification_id', 'bar_specification_id',
|
||||||
|
'pad_specification_id', 'handle_specification_id', 'after_assembly_tool_loading_length')
|
||||||
|
def _compute_tool_code(self):
|
||||||
|
for obj in self:
|
||||||
|
str_1 = 'GNDJ-%s' % obj.after_assembly_functional_tool_type_id.code
|
||||||
|
str_2 = ''
|
||||||
|
num = None
|
||||||
|
if obj.handle_specification_id:
|
||||||
|
if obj.integral_specification_id:
|
||||||
|
str_2 = '%s-D%sL%sB%sH%s-' % (
|
||||||
|
str_1, obj.integral_specification_id.blade_diameter, obj.after_assembly_tool_loading_length,
|
||||||
|
obj.integral_specification_id.blade_length, obj.handle_specification_id.total_length)
|
||||||
|
num = self._get_code(str_2)
|
||||||
|
elif obj.bar_specification_id:
|
||||||
|
str_2 = '%s-D%sL%sB%sH%s-' % (
|
||||||
|
str_1, obj.bar_specification_id.cutter_arbor_diameter, obj.after_assembly_tool_loading_length,
|
||||||
|
obj.bar_specification_id.blade_length, obj.handle_specification_id.total_length)
|
||||||
|
num = self._get_code(str_2)
|
||||||
|
elif obj.pad_specification_id:
|
||||||
|
str_2 = '%s-D%sL%sB%sH%s-' % (
|
||||||
|
str_1, obj.pad_specification_id.cutter_head_diameter, obj.after_assembly_tool_loading_length,
|
||||||
|
obj.pad_specification_id.cut_depth_max, obj.handle_specification_id.total_length,
|
||||||
|
)
|
||||||
|
num = self._get_code(str_2)
|
||||||
|
obj.tool_code = str_2 + str(num)
|
||||||
|
else:
|
||||||
|
obj.tool_code = None
|
||||||
|
|
||||||
|
def _get_code(self, str_2):
|
||||||
|
functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().search(
|
||||||
|
[('code', 'like', str_2)],
|
||||||
|
limit=1,
|
||||||
|
order="id desc"
|
||||||
|
)
|
||||||
|
if not functional_tool_assembly:
|
||||||
|
num = "%03d" % 1
|
||||||
|
else:
|
||||||
|
m = int(functional_tool_assembly.code[-3:]) + 1
|
||||||
|
num = "%03d" % m
|
||||||
|
return num
|
||||||
|
|
||||||
|
@api.depends('after_assembly_functional_tool_diameter', 'after_assembly_knife_tip_r_angle', 'tool_groups_id')
|
||||||
|
def _compute_name(self):
|
||||||
|
for obj in self:
|
||||||
|
if obj.tool_groups_id:
|
||||||
|
obj.after_assembly_functional_tool_name = '%s-D%sR%s' % (
|
||||||
|
obj.tool_groups_id.name, obj.after_assembly_functional_tool_diameter,
|
||||||
|
obj.after_assembly_knife_tip_r_angle)
|
||||||
|
else:
|
||||||
|
obj.after_assembly_functional_tool_name = None
|
||||||
|
|
||||||
@api.onchange('integral_code_id')
|
@api.onchange('integral_code_id')
|
||||||
def _onchange_after_assembly_functional_tool_diameter(self):
|
def _onchange_after_assembly_functional_tool_diameter(self):
|
||||||
@@ -453,6 +520,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
def get_desc_1(self, stock_lot):
|
def get_desc_1(self, stock_lot):
|
||||||
return {
|
return {
|
||||||
'barcode_id': stock_lot.id,
|
'barcode_id': stock_lot.id,
|
||||||
|
'code': self.tool_code,
|
||||||
|
'tool_groups_id': self.tool_groups_id.id,
|
||||||
'integral_code_id': self.integral_code_id.id,
|
'integral_code_id': self.integral_code_id.id,
|
||||||
'blade_code_id': self.blade_code_id.id,
|
'blade_code_id': self.blade_code_id.id,
|
||||||
'bar_code_id': self.bar_code_id.id,
|
'bar_code_id': self.bar_code_id.id,
|
||||||
@@ -487,6 +556,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
def get_desc_2(self, stock_lot, functional_tool_assembly_id):
|
def get_desc_2(self, stock_lot, functional_tool_assembly_id):
|
||||||
return {
|
return {
|
||||||
'barcode_id': stock_lot.id,
|
'barcode_id': stock_lot.id,
|
||||||
|
'code': self.tool_code,
|
||||||
|
'tool_groups_id': self.tool_groups_id.id,
|
||||||
'functional_tool_name_id': functional_tool_assembly_id.id,
|
'functional_tool_name_id': functional_tool_assembly_id.id,
|
||||||
'sf_cutting_tool_type_id': self.after_assembly_functional_tool_type_id.id,
|
'sf_cutting_tool_type_id': self.after_assembly_functional_tool_type_id.id,
|
||||||
'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
|
'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
|
||||||
|
|||||||
@@ -25,8 +25,10 @@
|
|||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id"/>
|
<field name="barcode_id"/>
|
||||||
|
<field name="code"/>
|
||||||
<field name="functional_tool_name"/>
|
<field name="functional_tool_name"/>
|
||||||
<field name="functional_tool_type_id"/>
|
<field name="functional_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="extension_length"/>
|
<field name="extension_length"/>
|
||||||
@@ -38,6 +40,7 @@
|
|||||||
<field name="replacement_tool_name" string="功能刀具名称"/>
|
<field name="replacement_tool_name" string="功能刀具名称"/>
|
||||||
<field name="replacement_tool_type_id" string="功能刀具类型"
|
<field name="replacement_tool_type_id" string="功能刀具类型"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="replacement_diameter" string="刀具直径(mm)"/>
|
<field name="replacement_diameter" string="刀具直径(mm)"/>
|
||||||
<field name="replacement_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
<field name="replacement_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||||
<field name="replacement_tool_setting_length" string="总长度(mm)"/>
|
<field name="replacement_tool_setting_length" string="总长度(mm)"/>
|
||||||
@@ -178,6 +181,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="functional_tool_name"/>
|
<field name="functional_tool_name"/>
|
||||||
<field name="functional_tool_type_id"/>
|
<field name="functional_tool_type_id"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="tool_loading_length"/>
|
<field name="tool_loading_length"/>
|
||||||
@@ -328,10 +332,12 @@
|
|||||||
|
|
||||||
<group string="组装参数信息">
|
<group string="组装参数信息">
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id" readonly="True"/>
|
<field name="barcode_id" invisible="True"/>
|
||||||
|
<field name="tool_code" readonly="True"/>
|
||||||
<field name="after_assembly_functional_tool_name" string="功能刀具名称"/>
|
<field name="after_assembly_functional_tool_name" string="功能刀具名称"/>
|
||||||
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
|
<field name="tool_groups_id"/>
|
||||||
<field name="after_assembly_functional_tool_diameter" string="刀具直径(mm)"/>
|
<field name="after_assembly_functional_tool_diameter" string="刀具直径(mm)"/>
|
||||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||||
<field name="after_assembly_new_former" string="新/旧"/>
|
<field name="after_assembly_new_former" string="新/旧"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user