新增加工方式、刀尖特征、柄部类型、走刀方向、适合冷却液五个模型对象;刀具物料查询新增上述五个关联对象;对产品的整体式刀具物料能力参数进行补充。
This commit is contained in:
@@ -94,6 +94,48 @@ class SfToolMaterialSearch(models.Model):
|
||||
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1))
|
||||
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
|
||||
|
||||
suitable_machining_method_ids = fields.Many2many('sf.suitable.machining.method',
|
||||
'rel_suitable_machining_method', '适合加工方式')
|
||||
blade_tip_characteristics_ids = fields.Many2many('sf.blade.tip.characteristics',
|
||||
'rel_blade_tip_characteristics', '刀尖特征')
|
||||
handle_type_ids = fields.Many2many('sf.handle.type', 'rel_handle_type', '柄部类型')
|
||||
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction', '走刀方向')
|
||||
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant', '适合冷却液')
|
||||
|
||||
@api.constrains('suitable_machining_method_ids')
|
||||
def _check_suitable_machining_method_ids(self):
|
||||
for record in self:
|
||||
if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("适合加工方式不能为空!")
|
||||
|
||||
@api.constrains('blade_tip_characteristics_ids')
|
||||
def _check_blade_tip_characteristics_ids(self):
|
||||
for record in self:
|
||||
if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("刀尖特征不能为空!")
|
||||
if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("刀尖特征只能单选!")
|
||||
|
||||
@api.constrains('handle_type_ids')
|
||||
def _check_handle_type_ids(self):
|
||||
for record in self:
|
||||
if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("柄部类型不能为空!")
|
||||
if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("柄部类型只能单选!")
|
||||
|
||||
@api.constrains('cutting_direction_ids')
|
||||
def _check_cutting_direction_ids(self):
|
||||
for record in self:
|
||||
if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("走刀方向不能为空!")
|
||||
|
||||
@api.constrains('suitable_coolant_ids')
|
||||
def _check_suitable_coolant_ids(self):
|
||||
for record in self:
|
||||
if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
|
||||
raise ValidationError("适合冷却液不能为空!")
|
||||
|
||||
@api.constrains('integral_total_length')
|
||||
def _check_integral_total_length(self):
|
||||
if self.integral_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
|
||||
Reference in New Issue
Block a user