From dd5fcceb381eccbc1b08fd7afb08f8e6f15d04be Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 4 Jan 2023 14:52:24 +0700 Subject: update api wishlish for variant and product --- indoteknik_api/models/product_product.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/models') 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 -- cgit v1.2.3