summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-10-13 16:43:59 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-10-13 16:43:59 +0700
commit3a5b05bee24feaadc8d6b5fe078fd6cf56989ba7 (patch)
tree435617837217f4869c1eb5acb50b625da4331b31 /indoteknik_api/models
parent47be053bafe8e212e7c98332666819e65428c4e3 (diff)
parent6029c9e3a0b42a6faef373e6dd2f5bf57cef17a0 (diff)
Fix price and update product response API
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/product_pricelist.py3
-rw-r--r--indoteknik_api/models/product_template.py6
2 files changed, 6 insertions, 3 deletions
diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py
index a82fea1d..4e7f6adf 100644
--- a/indoteknik_api/models/product_pricelist.py
+++ b/indoteknik_api/models/product_pricelist.py
@@ -41,7 +41,8 @@ class ProductPricelist(models.Model):
if price > 0:
product = self.env['product.product'].browse(product_id)
if product:
- if product.web_tax_id and product.web_tax_id.price_include:
+ product = product.product_tmpl_id
+ if product.web_tax_id and not product.web_tax_id.price_include:
price *= (100 + product.web_tax_id.amount) / 100
price_discount = price
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py
index 0cbf605f..aa35d922 100644
--- a/indoteknik_api/models/product_template.py
+++ b/indoteknik_api/models/product_template.py
@@ -16,6 +16,7 @@ class ProductTemplate(models.Model):
'lowest_price': self.env['product.pricelist'].get_lowest_product_variant_price(product_template, product_pricelist_default),
'variant_total': len(product_template.product_variant_ids),
'stock_total': product_template.qty_stock_vendor,
+ 'weight': product_template.weight,
'manufacture': self.api_manufacture(product_template),
'categories': self.api_categories(product_template),
}
@@ -29,9 +30,10 @@ class ProductTemplate(models.Model):
detail_data['variants'].append({
'id': variant.id,
'code': variant.default_code or '',
- 'name': variant.name,
+ 'name': variant.display_name,
'price': self.env['product.pricelist'].compute_price(product_pricelist_default, variant.id),
- 'stock': variant.qty_stock_vendor
+ 'stock': variant.qty_stock_vendor,
+ 'weight': variant.weight,
})
data.update(detail_data)
return data