diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-21 10:32:47 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-21 10:32:47 +0700 |
| commit | 5f700464f6bbc7b38438a0a527554327f390fe78 (patch) | |
| tree | d057935ea016ee4a3a97f23c3ee2d9b715a8db7b /indoteknik_api/models/product_template.py | |
| parent | 752768d6cc29a231b47637653d4f3e4e293a4590 (diff) | |
Add 'attribute' on product detail result api
Add function get similar product by id
Diffstat (limited to 'indoteknik_api/models/product_template.py')
| -rw-r--r-- | indoteknik_api/models/product_template.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py index c5f10413..5c81dec4 100644 --- a/indoteknik_api/models/product_template.py +++ b/indoteknik_api/models/product_template.py @@ -27,14 +27,16 @@ class ProductTemplate(models.Model): 'description': product_template.website_description or '', } for variant in product_template.product_variant_ids: - detail_data['variants'].append({ + variant_data = { 'id': variant.id, 'code': variant.default_code or '', 'name': variant.display_name, 'price': self.env['product.pricelist'].compute_price(product_pricelist_default_discount_id, variant.id), 'stock': variant.qty_stock_vendor, 'weight': variant.weight, - }) + 'attribute': [x.name for x in variant.product_template_attribute_value_ids] + } + detail_data['variants'].append(variant_data) data.update(detail_data) return data |
