diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-24 15:54:27 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-24 15:54:27 +0700 |
| commit | a069927b8f9b2b5942dffc241ed8b79f2d57ecf8 (patch) | |
| tree | c465c665e93b76cf938c1eef76a76ef9be664f8c /indoteknik_api/controllers/api_v1/product.py | |
| parent | 3270307c573ca7a8970899dcc7ee02aa7260a6cb (diff) | |
Filter price_from and price_to di product Rest API
Diffstat (limited to 'indoteknik_api/controllers/api_v1/product.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index 0d5d89b6..d667c1b6 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -40,6 +40,14 @@ class Product(controller.Controller): if categories: query.append(('public_categ_ids', 'child_of', [int(x) for x in categories.split(',')])) + + price_from = kw.get('price_from') + if price_from and int(price_from): + query.append(('web_price_sorting', '>=', int(price_from))) + + price_to = kw.get('price_to') + if price_to and int(price_to): + query.append(('web_price_sorting', '<=', int(price_to))) product_variants = request.env['product.product'].search(query) product_variant_ids = [x.id for x in product_variants] |
