94 lines
3.1 KiB
Python
94 lines
3.1 KiB
Python
from odoo import fields, models, api
|
|
|
|
|
|
class SuitableMachiningMethod(models.Model):
|
|
_name = 'sf.suitable.machining.method'
|
|
_description = '适合加工方式'
|
|
|
|
name = fields.Char('名称')
|
|
image = fields.Image('图片')
|
|
|
|
|
|
class BladeTipCharacteristics(models.Model):
|
|
_name = 'sf.blade.tip.characteristics'
|
|
_description = '刀尖特征'
|
|
|
|
name = fields.Char('名称')
|
|
image = fields.Image('图片')
|
|
|
|
|
|
class HandleType(models.Model):
|
|
_name = 'sf.handle.type'
|
|
_description = '柄部类型'
|
|
|
|
name = fields.Char('名称')
|
|
image = fields.Image('图片')
|
|
|
|
|
|
class CuttingDirection(models.Model):
|
|
_name = 'sf.cutting.direction'
|
|
_description = '走刀方向'
|
|
|
|
name = fields.Char('名称')
|
|
image = fields.Image('图片')
|
|
|
|
|
|
class SuitableCoolant(models.Model):
|
|
_name = 'sf.suitable.coolant'
|
|
_description = '适合冷却液'
|
|
|
|
name = fields.Char('名称')
|
|
image = fields.Image('图片')
|
|
|
|
|
|
class CuttingSpeed(models.Model):
|
|
_name = 'sf.cutting.speed'
|
|
_description = '切削速度Vc'
|
|
|
|
# def _get_order(self):
|
|
# last_tool = self.search([], order='id desc', limit=1)
|
|
# if last_tool:
|
|
# last_order = int(last_tool.order)
|
|
# new_order = last_order + 1
|
|
# else:
|
|
# new_order = '1'
|
|
# return new_order
|
|
#
|
|
# order = fields.Char('序', default=_get_order, readonly=True)
|
|
|
|
product_template_id = fields.Many2one('product.template', string='产品')
|
|
|
|
execution_standard_id = fields.Char('执行标准')
|
|
material_code = fields.Char('材料代号')
|
|
material_name = fields.Char('材料名称')
|
|
material_grade = fields.Char('材料牌号')
|
|
tensile_strength = fields.Float('拉伸强度 (N/mm²)')
|
|
hardness = fields.Float('硬度(HRC)')
|
|
|
|
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
|
|
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
|
|
cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc')
|
|
cutting_speed_n4 = fields.Char('径向切宽 ae=15%D1 ap=L1max 切削速度Vc')
|
|
cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc')
|
|
rough_machining = fields.Char('粗加工 Vc(m/min)')
|
|
precision_machining = fields.Char('精加工 Vc(m/min)')
|
|
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
|
|
|
|
|
class FeedPerTooth(models.Model):
|
|
_name = 'sf.feed.per.tooth'
|
|
_description = '每齿走刀量fz'
|
|
|
|
product_template_id = fields.Many2one('product.template', string='产品')
|
|
|
|
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
|
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
|
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, compute='_compute_product_template_id')
|
|
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
|
unit = fields.Char('单位', default='fz')
|
|
|
|
@api.depends('product_template_id')
|
|
def _compute_product_template_id(self):
|
|
if self.product_template_id is not None:
|
|
self.blade_diameter = self.product_template_id.integral_blade_diameter
|