Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/新增上传模型功能

This commit is contained in:
jinling.yang
2023-08-24 17:32:25 +08:00
22 changed files with 810 additions and 394 deletions

View File

@@ -569,15 +569,20 @@ class MachineBrand(models.Model):
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['machine_brand_all_list']:
brand = self.env['sf.machine.brand'].search(
[("code", '=', item['code'])])
if not brand:
if item.get('image_brand'):
image = base64.b64decode(item['image_brand'])
else:
image = ''
self.env['sf.machine.brand'].create({
"id": item['id'],
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand),
"image_brand": image,
"tag_ids": self.env['sf.machine.brand.tags'].search(
[("name", 'in', item['tag_ids'])]).ids
})