summaryrefslogtreecommitdiff
path: root/indoteknik_api/models/product_product.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-01-23 09:20:18 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-01-23 09:20:18 +0000
commitda5f5134f56b2ccf1c1de16c3f7616ab3719f3ea (patch)
treebc1bcb4fb00f2659be81810d528a9cf2cc6ce20d /indoteknik_api/models/product_product.py
parente52cf84fd2284330412162b44066f29bd382f590 (diff)
parent8af5ee591aabc2d5d946c0eece93a5caab989975 (diff)
Merged in release (pull request #27)
Release
Diffstat (limited to 'indoteknik_api/models/product_product.py')
-rw-r--r--indoteknik_api/models/product_product.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py
index 6b02d91e..2e84b9f4 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -5,7 +5,6 @@ class ProductProduct(models.Model):
_inherit = 'product.product'
def api_single_response(self, product_product):
- base_url = self.env['ir.config_parameter'].get_param('web.base.url')
product_pricelist_default_discount_id = self.env['ir.config_parameter'].get_param('product.pricelist.default_discount_id')
product_pricelist_default_discount_id = int(product_pricelist_default_discount_id)
product_template = product_product.product_tmpl_id
@@ -14,7 +13,7 @@ class ProductProduct(models.Model):
'parent': {
'id': product_template.id,
'name': product_template.name,
- 'image': base_url + 'api/image/product.template/image_256/' + str(product_template.id) if product_template.image_256 else '',
+ 'image': self.env['ir.attachment'].api_image('product.template', 'image_256', product_template.id),
},
'code': product_product.default_code or '',
'name': product_product.display_name,
@@ -27,13 +26,12 @@ class ProductProduct(models.Model):
return data
def api_manufacture(self, product_template):
- base_url = self.env['ir.config_parameter'].get_param('web.base.url')
if product_template.x_manufacture:
manufacture = product_template.x_manufacture
return {
'id': manufacture.id,
'name': manufacture.x_name,
- 'image_promotion_1': base_url + 'api/image/x_manufactures/image_promotion_1/' + str(manufacture.id) if manufacture.image_promotion_1 else '',
- 'image_promotion_2': base_url + 'api/image/x_manufactures/image_promotion_2/' + str(manufacture.id) if manufacture.image_promotion_2 else '',
+ 'image_promotion_1': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_1', manufacture.id),
+ 'image_promotion_2': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_2', manufacture.id),
}
return {} \ No newline at end of file