summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1/product.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-13 16:13:18 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-13 16:13:18 +0700
commitee8f00646d8a1d6faa1d91c82e9c3778cc8e41f8 (patch)
tree926f1a022fd5ca18ac23f53b32abcd370f0bf5c1 /indoteknik_api/controllers/api_v1/product.py
parentbe2bc04768f9f423c66a612f4f183d20e70a3145 (diff)
parente7a18de25926714222159cd9b9281b2fab62063b (diff)
Merge branch 'production' into iman/pengajuan-tempo
# Conflicts: # indoteknik_custom/__manifest__.py # indoteknik_custom/models/__init__.py # indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_api/controllers/api_v1/product.py')
-rw-r--r--indoteknik_api/controllers/api_v1/product.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index 9673b3ef..b68eb0f9 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -96,6 +96,21 @@ class Product(controller.Controller):
return self.response(data, headers=[('Cache-Control', 'max-age=600, private')])
+ @http.route(prefix + 'product_variant/<id>/qty_available', auth='public', methods=['GET', 'OPTIONS'])
+ @controller.Controller.must_authorized()
+ def get_product_variant_stock_available_by_id(self, **kw):
+ id = int(kw.get('id'))
+ product = request.env['product.product'].search(
+ [('id', '=', id)], limit=1)
+
+ qty_available = product.free_qty
+
+ data = {
+ 'qty': qty_available,
+ }
+
+ return self.response(data, headers=[('Cache-Control', 'max-age=600, private')])
+
@http.route(prefix + 'product/template/price/<id>', auth='public', methods=['GET', 'OPTIONS'])
def get_product_template_price_by_id(self, **kw):
if not self.authenticate():