summaryrefslogtreecommitdiff
path: root/indoteknik_api/models/product_product.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-11 13:57:01 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-11 13:57:01 +0700
commit000a7fa68a738843c443145c1a8d102783e04fac (patch)
tree04b7c6bf423ce0cf93ea4a526408d71426caaf9e /indoteknik_api/models/product_product.py
parentd1b86303b0934c9f6348e7016822d449349540d3 (diff)
parent3b5871b8c364e819a2fbaf268e4693e848e6af0a (diff)
Merge branch 'release' into flashsale-solr
Diffstat (limited to 'indoteknik_api/models/product_product.py')
-rw-r--r--indoteknik_api/models/product_product.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py
index 8c60ce43..409b69c2 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -19,6 +19,26 @@ class ProductProduct(models.Model):
'code': product_product.default_code or '',
'name': product_product.display_name,
'price': self.env['product.pricelist'].compute_price(product_pricelist_default_discount_id, product_product.id),
+ '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
+
+ def v2_api_single_response(self, product_product):
+ product_pricelist_default_discount_id = self.env['ir.config_parameter'].get_param('product.pricelist.default_discount_id')
+ product_pricelist_default_discount_id = int(product_pricelist_default_discount_id)
+ product_template = product_product.product_tmpl_id
+ data = {
+ 'id': product_product.id,
+ 'parent': {
+ 'id': product_template.id,
+ 'name': product_template.name,
+ 'image': self.env['ir.attachment'].api_image('product.template', 'image_256', product_template.id),
+ },
+ 'code': product_product.default_code or '',
+ 'name': product_product.display_name,
'price': {
'price': product_product._get_website_price_exclude_tax(),
'discount_percentage': product_product._get_website_disc(0),