diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
| commit | 1094670e6fc35e5150b612b32e1f497b36c022b3 (patch) | |
| tree | 4482491680db1554c28fb380480ada5282fac8f0 /indoteknik_api/controllers/api_v1/product.py | |
| parent | c631620706a24426faea6b43c2a0602eebf9a5e4 (diff) | |
| parent | dbe24b9cd600c7b5a9d0587f80a782ed93c9a761 (diff) | |
Merge branch 'production' into iman/telegram
# Conflicts:
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/stock_picking.py
Diffstat (limited to 'indoteknik_api/controllers/api_v1/product.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index e779e623..32362582 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -74,7 +74,6 @@ class Product(controller.Controller): if qty_available > 0: qty = qty_available + total_adem + total_excell - sla_date = '1 Hari' elif qty_altama > 0 or qty_vendor > 0: qty = total_adem if qty_altama > 0 else total_excell sla_date = '2-4 Hari' @@ -97,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(): |
