summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-07-27 08:21:56 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-07-27 08:21:56 +0700
commit4e942ec974303d0df73eecb270f2bcf127eaf2a7 (patch)
tree1d14272365995278c2141403fd40fd1c7f88de50
parentc0d30564d32210b9edb4c523ca8632e86de0f0a2 (diff)
add qty stock vendor to product non altama
-rw-r--r--indoteknik_api/controllers/api_v1/product.py20
-rwxr-xr-xindoteknik_custom/models/user_activity_log.py1
2 files changed, 13 insertions, 8 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index 7ec6459b..20684107 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -29,6 +29,12 @@ class Product(controller.Controller):
qty = 0
sla_date = '-'
+ # 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:
@@ -37,11 +43,7 @@ class Product(controller.Controller):
qty_altama -= int(qty_altama * 0.1)
qty_altama = math.ceil(float(qty_altama))
total_adem = qty_altama
- # 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
+
if qty_available > 0:
qty = qty_available + total_adem + total_excell
sla_date = '1 Hari'
@@ -53,8 +55,12 @@ class Product(controller.Controller):
except:
print('error')
else:
- qty = qty_available
- sla_date = product_sla.sla or '-'
+ if qty_vendor > 0:
+ qty = total_excell
+ sla_date = '2-4 Hari'
+ else:
+ qty = qty_available
+ sla_date = product_sla.sla or '-'
data = {
'qty': qty,
diff --git a/indoteknik_custom/models/user_activity_log.py b/indoteknik_custom/models/user_activity_log.py
index cf40258f..9630e3ab 100755
--- a/indoteknik_custom/models/user_activity_log.py
+++ b/indoteknik_custom/models/user_activity_log.py
@@ -162,7 +162,6 @@ class UserActivityLog(models.Model):
activity_logs = self.env['user.activity.log'].search([
('url', 'ilike', '%/shop/product/%'),
('update_product', '!=', True),
- ('url', 'not ilike', 'shopping'),
], limit=1000, order='create_date DESC')
for activity_log in activity_logs: