diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-27 09:44:48 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-27 09:44:48 +0700 |
| commit | 742213021f5e301518512c4f190b91df8182337a (patch) | |
| tree | f97d2d85811338220ca6d20482d18930d976b08b /indoteknik_api/controllers/api_v1 | |
| parent | ca21d92d64d9d8574cbfa4c227989f05d6ca9f0b (diff) | |
| parent | 8e79387dd2f1172c3ee1f2aa4588ae71d21ea36d (diff) | |
Merge commit '8e79387dd2f1172c3ee1f2aa4588ae71d21ea36d'
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 7 |
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))) |
