diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-13 09:50:57 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-13 09:50:57 +0700 |
| commit | 32bf7b115ec71e72d9cde58bfa3c0304c4b1ffcb (patch) | |
| tree | 19257db60cdd44a5527825825ab0032a2693f74d /indoteknik_api/models | |
| parent | 3085bfa4333cbc99ed4a0e432c8313cf7009cd2a (diff) | |
| parent | 604ef36b09c2eb2cf89f5b592ab775ba87e0ce88 (diff) | |
Merge remote-tracking branch 'origin/staging' into real-stock
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_product.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index 14fe68cb..edf95a58 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -10,6 +10,8 @@ class ProductProduct(models.Model): 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 + stock = product_product.qty_stock_vendor + stock = stock if stock > 0 else 1 data = { 'id': product_product.id, 'parent': { @@ -20,7 +22,7 @@ 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, + 'stock': stock, 'weight': product_product.weight, 'attributes': [x.name for x in product_product.product_template_attribute_value_ids], 'manufacture' : self.api_manufacture(product_product) @@ -61,6 +63,8 @@ class ProductProduct(models.Model): price_discount = flashsale_price discount_percentage = flashsale_discount + stock = product_product.qty_stock_vendor + stock = stock if stock > 0 else 1 product_template = product_product.product_tmpl_id data = { 'id': product_product.id, @@ -76,7 +80,7 @@ class ProductProduct(models.Model): 'discount_percentage': discount_percentage, 'price_discount': price_discount }, - 'stock': product_product.qty_stock_vendor, + 'stock': stock, 'weight': product_product.weight, 'attributes': [x.name for x in product_product.product_template_attribute_value_ids], 'manufacture' : self.api_manufacture(product_product) |
