summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-10-27 09:13:19 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-10-27 09:13:19 +0700
commit8e79387dd2f1172c3ee1f2aa4588ae71d21ea36d (patch)
tree3c3de50c3f5d30f736419531817786e205715df8
parent4bf707b3d4db40296e108714be863571dccbf3fc (diff)
Search product by ready stock
-rw-r--r--indoteknik_api/controllers/api_v1/product.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py
index d667c1b6..d8006873 100644
--- a/indoteknik_api/controllers/api_v1/product.py
+++ b/indoteknik_api/controllers/api_v1/product.py
@@ -14,14 +14,14 @@ class Product(controller.Controller):
name = kw.get('name')
manufactures = kw.get('manufactures')
categories = kw.get('categories')
+ ready_stock = kw.get('ready_stock')
- require_betweens = ['name', 'manufactures', 'categories']
+ require_betweens = ['name', 'manufactures', 'categories', 'ready_stock']
is_fulfill = False
for required in require_betweens:
if kw.get(required):
is_fulfill = True
- # If not fulfill in require_between
if not is_fulfill:
return self.response(code=400, description='name or manufactures or categories is required')
@@ -41,6 +41,9 @@ class Product(controller.Controller):
if categories:
query.append(('public_categ_ids', 'child_of', [int(x) for x in categories.split(',')]))
+ if ready_stock == '1':
+ query.append(('virtual_qty', '>', 0))
+
price_from = kw.get('price_from')
if price_from and int(price_from):
query.append(('web_price_sorting', '>=', int(price_from)))