summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
-rw-r--r--indoteknik_api/controllers/api_v1/product.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index 8dea4c28..5ed6490c 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -16,9 +16,9 @@ class Product(controller.Controller):
def get_product_template_stock_by_id(self, **kw):
id = kw.get('id')
stock_location_id = 57 # Ubah dengan location_id yang diinginkan
- template = request.env['product.product'].search([('id', '=', id)], limit=1)
- stock = template.qty_available
- item_code = template.default_code
+ product = request.env['product.product'].search([('id', '=', id)], limit=1)
+ stock = product.qty_available
+ item_code = product.default_code
qty_altama = request.env['product.template'].get_stock_altama(item_code)
qty_altama -= int(qty_altama * 0.1)
rounded_qty_altama = math.ceil(float(qty_altama))
@@ -28,7 +28,7 @@ class Product(controller.Controller):
sla_date = '-'
qty_available = 0
- for stock in template.stock_quant_ids:
+ for stock in product.stock_quant_ids:
if stock.location_id.id == 57:
qty_available += stock.quantity
@@ -40,8 +40,9 @@ class Product(controller.Controller):
qty = 0
sla_date = 'Indent'
elif qty_available > 10:
- if template.x_manufacture.id == 10 or template.x_manufacture.id == 122 or template.x_manufacture.id == 89:
+ if product.x_manufacture.id == 10 or product.x_manufacture.id == 122 or product.x_manufacture.id == 89:
qty = qty_available + qty_b2b_altama
+ sla_date = '2-4 Hari'
else:
qty = qty_available
sla_date = '1 Hari'