diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-24 16:11:57 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-24 16:11:57 +0700 |
| commit | 24afe5ec17b16700aca266699a5963f23380f63e (patch) | |
| tree | 5123f7f39eefc917824ef784e91f51d756b43035 | |
| parent | 12f1df2b2dabd0fba5dc0e2584c9a588c378118c (diff) | |
(andri) fix stock live
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index e97a7ff8..2aeba7e8 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -108,10 +108,10 @@ class Product(controller.Controller): ('product_id', '=', id), ('is_winner', '=', True) ]) - stock_vendor = request.env['stock.vendor'].search([ - ('product_variant_id', '=', id), - ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) - ], limit=1) + # stock_vendor = request.env['stock.vendor'].search([ + # ('product_variant_id', '=', id), + # ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) + # ], limit=1) product = product_pruchase.product_id @@ -136,38 +136,38 @@ class Product(controller.Controller): sla_date = f'{slatime} Hari' # Qty Stock Vendor - qty_vendor = stock_vendor.quantity - qty_vendor -= int(qty_vendor * 0.1) - qty_vendor = math.ceil(float(qty_vendor)) - total_excell = qty_vendor - - is_altama_product = product.x_manufacture.id in [10, 122, 89] - if is_altama_product: - try: - # Qty Altama - qty_altama = request.env['product.template'].get_stock_altama( - product.default_code) - qty_altama -= int(qty_altama * 0.1) - qty_altama = math.ceil(float(qty_altama)) - total_adem = qty_altama - - 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 = f'{slatime} Hari' - else: - sla_date = f'{slatime} Hari' - except: - print('error') - else: - if qty_available > 0: - qty = qty_available - sla_date = f'1 Hari' - elif qty_vendor > 0: - qty = total_excell - sla_date = f'{slatime} Hari' + # qty_vendor = stock_vendor.quantity + # qty_vendor -= int(qty_vendor * 0.1) + # qty_vendor = math.ceil(float(qty_vendor)) + # total_excell = qty_vendor + + # is_altama_product = product.x_manufacture.id in [10, 122, 89] + # if is_altama_product: + # try: + # # Qty Altama + # qty_altama = request.env['product.template'].get_stock_altama( + # product.default_code) + # qty_altama -= int(qty_altama * 0.1) + # qty_altama = math.ceil(float(qty_altama)) + # total_adem = qty_altama + + # 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 = f'{slatime} Hari' + # else: + # sla_date = f'{slatime} Hari' + # except: + # print('error') + # else: + # if qty_available > 0: + # qty = qty_available + # sla_date = f'1 Hari' + # elif qty_vendor > 0: + # qty = total_excell + # sla_date = f'{slatime} Hari' data = { 'qty': qty, |
