summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-01-24 13:17:00 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-01-24 13:17:00 +0700
commit3f311b95265adf1902e650b12fba93cf81a7f72d (patch)
tree86357713102fbfba446e6015b225ec3d2a46b4c0 /indoteknik_api/controllers/api_v1
parent2a3a0a7e88ef24456eeda070a7d74f1457efdb18 (diff)
change image logic in rest api new product
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
-rw-r--r--indoteknik_api/controllers/api_v1/product.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index 23dcf48e..dc941f13 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -48,8 +48,9 @@ class Product(controller.Controller):
'manufacture_id': brand.id,
'sequence': brand.sequence if brand.sequence else count,
'name': brand.x_name,
- 'image': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(
- brand.id) if brand.x_logo_manufacture else '',
+ # 'image': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(
+ # brand.id) if brand.x_logo_manufacture else '',
+ 'image': request.env['ir.attachment'].api_image('x_manufactures', 'x_logo_manufacture', brand.id),
})
continue
@@ -74,8 +75,9 @@ class Product(controller.Controller):
'manufacture_id': brand.id,
'sequence': brand.sequence if brand.sequence else count,
'name': brand.x_name,
- 'image': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(
- brand.id) if brand.x_logo_manufacture else '',
+ # 'image': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(
+ # brand.id) if brand.x_logo_manufacture else '',
+ 'image': request.env['ir.attachment'].api_image('x_manufactures', 'x_logo_manufacture', brand.id),
'products_total': count_products,
'products': [request.env['product.template'].api_single_response(x) for x in products]
})