From 0b5623adc1c6d6f5ef7a4d68f42bcf2f524107c1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 15 Oct 2024 12:05:53 +0700 Subject: update code ambil data stock mandatory ke stock awailable --- indoteknik_api/controllers/api_v1/product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/controllers/api_v1/product.py') diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index e779e623..8fe48932 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -73,7 +73,10 @@ class Product(controller.Controller): total_adem = qty_altama if qty_available > 0: - qty = qty_available + total_adem + total_excell + qty = qty_available + sla_date = '1 Hari' + elif qty_available > 0 and qty_altama > 0: + qty = qty_available sla_date = '1 Hari' elif qty_altama > 0 or qty_vendor > 0: qty = total_adem if qty_altama > 0 else total_excell -- cgit v1.2.3 From 0e00a82659579fa0fdfe1f51687b3568cd62a955 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 16 Oct 2024 09:56:18 +0700 Subject: back to original code --- indoteknik_api/controllers/api_v1/product.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indoteknik_api/controllers/api_v1/product.py') diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index 8fe48932..9673b3ef 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -73,11 +73,7 @@ class Product(controller.Controller): total_adem = qty_altama if qty_available > 0: - qty = qty_available - sla_date = '1 Hari' - elif qty_available > 0 and qty_altama > 0: - qty = qty_available - sla_date = '1 Hari' + qty = qty_available + total_adem + total_excell elif qty_altama > 0 or qty_vendor > 0: qty = total_adem if qty_altama > 0 else total_excell sla_date = '2-4 Hari' -- cgit v1.2.3 From 4c2325d4a983ced3a25a9d53d7613a9186360b17 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 16 Oct 2024 13:15:11 +0700 Subject: update ready stock picup quantity --- indoteknik_api/controllers/api_v1/product.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indoteknik_api/controllers/api_v1/product.py') 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//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/', auth='public', methods=['GET', 'OPTIONS']) def get_product_template_price_by_id(self, **kw): if not self.authenticate(): -- cgit v1.2.3 From c19bfe2d5c4a40c14e6da71a0745c4ab23a49716 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 20 Nov 2024 10:49:20 +0700 Subject: ubah source data dari free qty ke qty free bandengan --- indoteknik_api/controllers/api_v1/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_api/controllers/api_v1/product.py') diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index b68eb0f9..32362582 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -103,7 +103,7 @@ class Product(controller.Controller): product = request.env['product.product'].search( [('id', '=', id)], limit=1) - qty_available = product.free_qty + qty_available = product.qty_free_bandengan data = { 'qty': qty_available, -- cgit v1.2.3