summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1/product.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-29 10:05:58 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-29 10:05:58 +0700
commit8906f678c23090d70d16191dc1fe76e518e8e9d9 (patch)
treea98cb41a39064f692d764338177b84fd14bed82a /indoteknik_api/controllers/api_v1/product.py
parentd0bd4a82c923789a931f9433085f4219c6d7346a (diff)
parent0080b6b1da5f181cee32fae7bb5166ce65165374 (diff)
Merge branch 'production' into CR/quotation-noPo
# Conflicts: # indoteknik_custom/models/user_company_request.py
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..32362582 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.qty_free_bandengan
+
+ 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():