diff options
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_template.py | 9 | ||||
| -rw-r--r-- | indoteknik_api/models/res_users.py | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py index b9df0f5f..c3df97a5 100644 --- a/indoteknik_api/models/product_template.py +++ b/indoteknik_api/models/product_template.py @@ -68,10 +68,17 @@ class ProductTemplate(models.Model): } if with_detail != '': + variants = [self.env['product.product'].v2_api_single_response(variant, pricelist=pricelist) for variant in product_template.product_variant_ids] + lowest_price = variants[0]['price'] + for variant in variants: + if variant["price"]["price_discount"] < lowest_price["price_discount"]: + lowest_price = variant['price'] + data_with_detail = { + 'lowest_price': lowest_price, 'image': self.env['ir.attachment'].api_image('product.template', 'image_512', product_template.id), 'display_name': product_template.display_name, - 'variants': [self.env['product.product'].v2_api_single_response(variant, pricelist=pricelist) for variant in product_template.product_variant_ids], + 'variants': variants, 'description': product_template.website_description or '', } data.update(data_with_detail) diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py index efe98815..80de083d 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -53,6 +53,7 @@ class ResUsers(models.Model): 'industry_id': user.industry_id.id or None, 'tax_name': user.nama_wajib_pajak or '', 'npwp': user.npwp or '', + 'rajaongkir_city_id': user.kota_id.rajaongkir_id or 0, } if user.kota_id: |
