材料等同步Bug修复
This commit is contained in:
@@ -32,20 +32,18 @@ class sfProductionMaterials(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['production_materials_yesterday_list']:
|
for item in result['production_materials_yesterday_list']:
|
||||||
if item:
|
if item:
|
||||||
brand = self.env['sf.production.materials'].search(
|
materials = self.env['sf.production.materials'].search(
|
||||||
[("materials_no", '=', item['materials_no'])])
|
[("materials_no", '=', item['materials_no'])])
|
||||||
if brand:
|
if materials:
|
||||||
brand.id = item['id'],
|
materials.name = item['name']
|
||||||
brand.name = item['name'],
|
materials.remark = item['remark']
|
||||||
brand.remark = item['remark'],
|
materials.active = item['active']
|
||||||
brand.active = item['active']
|
|
||||||
else:
|
else:
|
||||||
self.env['sf.production.materials'].create({
|
self.env['sf.production.materials'].create({
|
||||||
"id": item['id'],
|
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"materials_no": item['materials_no'],
|
"materials_no": item['materials_no'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
"active": item['active']
|
"active": item['active'],
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
@@ -65,17 +63,20 @@ class sfProductionMaterials(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['production_materials_all_list']:
|
for item in result['production_materials_all_list']:
|
||||||
if item:
|
if item:
|
||||||
|
materials = self.env['sf.production.materials'].search(
|
||||||
brand = self.env['sf.production.materials'].search(
|
|
||||||
[("materials_no", '=', item['materials_no'])])
|
[("materials_no", '=', item['materials_no'])])
|
||||||
if not brand:
|
if not materials:
|
||||||
self.env['sf.production.materials'].create({
|
self.env['sf.production.materials'].create({
|
||||||
"id": item['id'],
|
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"materials_no": item['materials_no'],
|
"materials_no": item['materials_no'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
"active": item['active']
|
"active": item['active'],
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
materials.name = item['name']
|
||||||
|
materials.remark = item['remark']
|
||||||
|
materials.active = item['active']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
@@ -102,23 +103,22 @@ class sfMaterialModel(models.Model):
|
|||||||
materials_model = self.env['sf.materials.model'].search(
|
materials_model = self.env['sf.materials.model'].search(
|
||||||
[("materials_no", '=', item['materials_no'])])
|
[("materials_no", '=', item['materials_no'])])
|
||||||
if materials_model:
|
if materials_model:
|
||||||
materials_model.id = item['id'],
|
materials_model.name = item['name']
|
||||||
materials_model.name = item['name'],
|
materials_model.materials_no = item['materials_no']
|
||||||
materials_model.materials_no = item['materials_no'],
|
materials_model.remark = item['remark']
|
||||||
materials_model.remark = item['remark'],
|
materials_model.tensile_strength = item['tensile_strength']
|
||||||
materials_model.tensile_strength = item['tensile_strength'],
|
materials_model.hardness = item['hardness']
|
||||||
materials_model.hardness = item['hardness'],
|
materials_model.materials_no = item['materials_no']
|
||||||
materials_model.materials_no = item['materials_no'],
|
materials_model.rough_machining = item['rough_machining']
|
||||||
materials_model.rough_machining = item['rough_machining'],
|
materials_model.finish_machining = item['finish_machining']
|
||||||
materials_model.finish_machining = item['finish_machining'],
|
materials_model.mf_materia_post = item['mf_materia_post']
|
||||||
materials_model.mf_materia_post = item['mf_materia_post'],
|
|
||||||
materials_model.materials_id = self.env['sf.production.materials'].search(
|
materials_model.materials_id = self.env['sf.production.materials'].search(
|
||||||
[("materials_no", '=', item['materials_id.materials_no'])]).id,
|
[("materials_no", '=', item['materials_id.materials_no'])]).id
|
||||||
materials_model.need_h = item['need_h'],
|
materials_model.need_h = item['need_h']
|
||||||
materials_model.density = item['density']
|
materials_model.density = item['density']
|
||||||
|
materials_model.active = item['active']
|
||||||
else:
|
else:
|
||||||
self.env['sf.materials.model'].create({
|
self.env['sf.materials.model'].create({
|
||||||
"id": item['id'],
|
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"materials_no": item['materials_no'],
|
"materials_no": item['materials_no'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
@@ -132,8 +132,6 @@ class sfMaterialModel(models.Model):
|
|||||||
"need_h": item['need_h'],
|
"need_h": item['need_h'],
|
||||||
"mf_materia_post": item['mf_materia_post'],
|
"mf_materia_post": item['mf_materia_post'],
|
||||||
"density": item['density'],
|
"density": item['density'],
|
||||||
# "tag_ids": item['tag_ids']
|
|
||||||
|
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
@@ -171,6 +169,22 @@ class sfMaterialModel(models.Model):
|
|||||||
# "tag_ids": item['tag_ids']
|
# "tag_ids": item['tag_ids']
|
||||||
|
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
materials_model.name = item['name']
|
||||||
|
materials_model.materials_no = item['materials_no']
|
||||||
|
materials_model.remark = item['remark']
|
||||||
|
materials_model.tensile_strength = item['tensile_strength']
|
||||||
|
materials_model.hardness = item['hardness']
|
||||||
|
materials_model.materials_no = item['materials_no']
|
||||||
|
materials_model.rough_machining = item['rough_machining']
|
||||||
|
materials_model.finish_machining = item['finish_machining']
|
||||||
|
materials_model.mf_materia_post = item['mf_materia_post']
|
||||||
|
materials_model.materials_id = self.env['sf.production.materials'].search(
|
||||||
|
[("materials_no", '=', item['materials_id.materials_no'])]).id
|
||||||
|
materials_model.need_h = item['need_h']
|
||||||
|
materials_model.density = item['density']
|
||||||
|
materials_model.active = item['active']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
@@ -197,8 +211,8 @@ class sfProductionProcessCategory(models.Model):
|
|||||||
production_process_category = self.env['sf.production.process.category'].search(
|
production_process_category = self.env['sf.production.process.category'].search(
|
||||||
[("code", '=', item['code'])])
|
[("code", '=', item['code'])])
|
||||||
if production_process_category:
|
if production_process_category:
|
||||||
production_process_category.name = item['name'],
|
production_process_category.name = item['name']
|
||||||
production_process_category.code = item['code'],
|
production_process_category.code = item['code']
|
||||||
production_process_category.active = item['active']
|
production_process_category.active = item['active']
|
||||||
else:
|
else:
|
||||||
self.env['sf.production.process.category'].create({
|
self.env['sf.production.process.category'].create({
|
||||||
@@ -231,6 +245,9 @@ class sfProductionProcessCategory(models.Model):
|
|||||||
"code": item['code'],
|
"code": item['code'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
category.name = item['name']
|
||||||
|
category.active = item['active']
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
@@ -254,16 +271,15 @@ class sfProductionProcess(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['production_process_yesterday_list']:
|
for item in result['production_process_yesterday_list']:
|
||||||
if item:
|
if item:
|
||||||
brand = self.env['sf.production.process'].search(
|
production_process = self.env['sf.production.process'].search(
|
||||||
[("process_encode", '=', item['process_encode'])])
|
[("process_encode", '=', item['process_encode'])])
|
||||||
if brand:
|
if production_process:
|
||||||
brand.name = item['name'],
|
production_process.name = item['name']
|
||||||
brand.category_id = self.env['sf.production.process.category'].search(
|
production_process.category_id = self.env['sf.production.process.category'].search(
|
||||||
[("code", '=', item['category_code'])]).id,
|
[("code", '=', item['category_code'])]).id
|
||||||
brand.process_encode = item['process_encode'],
|
production_process.process_encode = item['process_encode']
|
||||||
brand.remark = item['remark'],
|
production_process.remark = item['remark']
|
||||||
brand.active = item['active'],
|
production_process.active = item['active']
|
||||||
brand.remark = item['remark']
|
|
||||||
else:
|
else:
|
||||||
self.env['sf.production.process'].create({
|
self.env['sf.production.process'].create({
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
@@ -290,9 +306,9 @@ class sfProductionProcess(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['production_process_all_list']:
|
for item in result['production_process_all_list']:
|
||||||
if item:
|
if item:
|
||||||
brand = self.env['sf.production.process'].search(
|
production_process = self.env['sf.production.process'].search(
|
||||||
[("process_encode", '=', item['process_encode'])])
|
[("process_encode", '=', item['process_encode'])])
|
||||||
if not brand:
|
if not production_process:
|
||||||
self.env['sf.production.process'].create({
|
self.env['sf.production.process'].create({
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"category_id": self.env['sf.production.process.category'].search(
|
"category_id": self.env['sf.production.process.category'].search(
|
||||||
@@ -303,6 +319,12 @@ class sfProductionProcess(models.Model):
|
|||||||
# "tag_ids": item['tag_ids']
|
# "tag_ids": item['tag_ids']
|
||||||
|
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
production_process.name = item['name']
|
||||||
|
production_process.category_id = self.env['sf.production.process.category'].search(
|
||||||
|
[("code", '=', item['category_code'])]).id
|
||||||
|
production_process.remark = item['remark']
|
||||||
|
production_process.active = item['active']
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
@@ -326,14 +348,12 @@ class sfProcessingTechnology(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['processing_technology_yesterday_list']:
|
for item in result['processing_technology_yesterday_list']:
|
||||||
if item:
|
if item:
|
||||||
brand = self.env['sf.processing.technology'].search(
|
processing_technology = self.env['sf.processing.technology'].search(
|
||||||
[("process_encode", '=', item['process_encode'])])
|
[("process_encode", '=', item['process_encode'])])
|
||||||
if brand:
|
if processing_technology:
|
||||||
brand.id = item['id'],
|
processing_technology.name = item['name']
|
||||||
brand.name = item['name'],
|
processing_technology.remark = item['remark']
|
||||||
brand.process_encode = item['process_encode'],
|
processing_technology.active = item['active']
|
||||||
brand.remark = item['remark'],
|
|
||||||
brand.active = item['active']
|
|
||||||
else:
|
else:
|
||||||
self.env['sf.processing.technology'].create({
|
self.env['sf.processing.technology'].create({
|
||||||
"id": item['id'],
|
"id": item['id'],
|
||||||
@@ -361,18 +381,20 @@ class sfProcessingTechnology(models.Model):
|
|||||||
if result['status'] == 1:
|
if result['status'] == 1:
|
||||||
for item in result['processing_technology_all_list']:
|
for item in result['processing_technology_all_list']:
|
||||||
if item:
|
if item:
|
||||||
brand = self.env['sf.processing.technology'].search(
|
processing_technology = self.env['sf.processing.technology'].search(
|
||||||
[("process_encode", '=', item['process_encode'])])
|
[("process_encode", '=', item['process_encode'])])
|
||||||
if not brand:
|
if not processing_technology:
|
||||||
self.env['sf.processing.technology'].create({
|
self.env['sf.processing.technology'].create({
|
||||||
"id": item['id'],
|
"id": item['id'],
|
||||||
"name": item['name'],
|
"name": item['name'],
|
||||||
"process_encode": item['process_encode'],
|
"process_encode": item['process_encode'],
|
||||||
"remark": item['remark'],
|
"remark": item['remark'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
# "tag_ids": item['tag_ids']
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
processing_technology.name = item['name']
|
||||||
|
processing_technology.remark = item['remark']
|
||||||
|
processing_technology.active = item['active']
|
||||||
else:
|
else:
|
||||||
raise ValidationError("认证未通过")
|
raise ValidationError("认证未通过")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user