summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-01-05 02:21:27 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-01-05 02:21:27 +0000
commitf56ff7fb53e25c188663f643f06691d8d71bd34a (patch)
tree9fd71e2ea00bd0e13d133faff8b467dd799dcdd3 /indoteknik_api/models
parentb0f4f1875216bbb0347c082f38b91b59e5bbf50c (diff)
parentdd5fcceb381eccbc1b08fd7afb08f8e6f15d04be (diff)
Merged in Feature/wishlish (pull request #13)
update api wishlish for variant and product
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 4cff6b5c..b5253591 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -22,5 +22,18 @@ class ProductTemplate(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