summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-01-04 14:52:24 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-01-04 14:52:24 +0700
commitdd5fcceb381eccbc1b08fd7afb08f8e6f15d04be (patch)
treed1ee81a002f87f1de3d7f03801c2f3a8c3283f57 /indoteknik_api/models
parentdb2f280683b29ac5d32158f3fab0f3df671935e9 (diff)
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