夹具型号同步修复
This commit is contained in:
@@ -308,6 +308,13 @@ class MachineToolType(models.Model):
|
||||
active = fields.Boolean('有效', default=True)
|
||||
code = fields.Char('编码')
|
||||
|
||||
def _get_ids(self, machine_tool_type_code):
|
||||
machine_tool_type_ids = []
|
||||
for item in machine_tool_type_code:
|
||||
machine_tool_type = self.search([('code', '=', item)])
|
||||
machine_tool_type_ids.append(machine_tool_type.id)
|
||||
return [(6, 0, machine_tool_type_ids)]
|
||||
|
||||
|
||||
class MachineToolCategory(models.Model):
|
||||
_name = 'sf.machine_tool.category'
|
||||
|
||||
@@ -53,5 +53,10 @@ class FixtureModel(models.Model):
|
||||
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# obj = super(FixtureModel, self).create(vals)
|
||||
# return obj
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1519,10 +1519,11 @@ class SyncFixtureModel(models.Model):
|
||||
"materials_model_id": self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||
"driving_way": item['driving_way'],
|
||||
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
|
||||
[('code', '=', item['apply_machine_tool_type_code'])]).id,
|
||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||
item['apply_machine_tool_type_code']).id,
|
||||
"through_hole_size": item['through_hole_size'],
|
||||
"screw_size": item['screw_size'],
|
||||
"active": item['active'],
|
||||
})
|
||||
else:
|
||||
fixture_model.write({
|
||||
@@ -1548,10 +1549,11 @@ class SyncFixtureModel(models.Model):
|
||||
"materials_model_id": self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||
"driving_way": item['driving_way'],
|
||||
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
|
||||
[('code', '=', item['apply_machine_tool_type_code'])]).id,
|
||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||
item['apply_machine_tool_type_code']).id,
|
||||
"through_hole_size": item['through_hole_size'],
|
||||
"screw_size": item['screw_size'],
|
||||
"active": item['active'],
|
||||
})
|
||||
else:
|
||||
raise ValidationError("认证未通过")
|
||||
@@ -1599,10 +1601,11 @@ class SyncFixtureModel(models.Model):
|
||||
"materials_model_id": self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||
"driving_way": item['driving_way'],
|
||||
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
|
||||
[('code', '=', item['apply_machine_tool_type_code'])]).id,
|
||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||
item['apply_machine_tool_type_code']).id,
|
||||
"through_hole_size": item['through_hole_size'],
|
||||
"screw_size": item['screw_size'],
|
||||
"active": item['active'],
|
||||
})
|
||||
else:
|
||||
fixture_model.write({
|
||||
@@ -1628,8 +1631,8 @@ class SyncFixtureModel(models.Model):
|
||||
"materials_model_id": self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||
"driving_way": item['driving_way'],
|
||||
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
|
||||
[('code', '=', item['apply_machine_tool_type_code'])]).id,
|
||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||
item['apply_machine_tool_type_code']).id,
|
||||
"through_hole_size": item['through_hole_size'],
|
||||
"screw_size": item['screw_size'],
|
||||
"active": item['active'],
|
||||
|
||||
Reference in New Issue
Block a user