diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-15 17:35:23 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-15 17:35:23 +0700 |
| commit | f6671dd4595af3c1075b27925f10c457854cecf8 (patch) | |
| tree | fadac999707657fc3ce1b0e359e5acc69d497308 /indoteknik_api/models/product_template.py | |
| parent | 2861ba3cd7844079ce85ad31aa1470e95de7f71d (diff) | |
Fitur crud cart dan wishlist
Update struktur response product
Diffstat (limited to 'indoteknik_api/models/product_template.py')
| -rw-r--r-- | indoteknik_api/models/product_template.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py index 8ced0374..b616a773 100644 --- a/indoteknik_api/models/product_template.py +++ b/indoteknik_api/models/product_template.py @@ -24,23 +24,11 @@ class ProductTemplate(models.Model): data_with_detail = { 'image': base_url + 'api/image/product.template/image_512/' + str(product_template.id) if product_template.image_512 else '', 'display_name': product_template.display_name, - 'variants': [], + 'variants': [self.env['product.product'].api_single_response(variant) for variant in product_template.product_variant_ids], 'description': product_template.website_description or '', 'solr_flag': product_template.solr_flag, 'product_rating': product_template.product_rating, } - for variant in product_template.product_variant_ids: - data_with_detail['variants'].append({ - '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, - 'attributes': [x.name for x in variant.product_template_attribute_value_ids], - 'solr_flag': product_template.solr_flag, - 'product_rating': product_template.product_rating, - }) data.update(data_with_detail) return data |
