summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-01-05 11:24:53 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-01-05 11:24:53 +0700
commit9a3a8c37b65d6017bae50d56b4c5bd1ea641a3b1 (patch)
treed46e635d9977350d7414248fc9b5a375fd00f3e0 /indoteknik_api/models
parent329c743adc3bb0cf63b7586efd8adbde58a62c24 (diff)
parent32a38516894abbd7aa010f99a7fdbc18268b3bdc (diff)
Merge branch 'staging' of bitbucket.org:altafixco/indoteknik-addons into staging
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/product_product.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py
index 92c738fd..6b02d91e 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -22,5 +22,18 @@ class ProductProduct(models.Model):
'stock': product_product.qty_stock_vendor,
'weight': product_product.weight,
'attributes': [x.name for x in product_product.product_template_attribute_value_ids],
+ 'manufacture' : self.api_manufacture(product_product)
}
- return data \ No newline at end of file
+ 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 '',
+ }
+ return {} \ No newline at end of file