diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-27 11:45:59 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-27 11:45:59 +0700 |
| commit | 657e16e174b1896d62ed80ed6ab267c7845c0381 (patch) | |
| tree | 404a9d5a0f211bfd20c13a034dc35ae0de25e3ef /indoteknik_api/controllers/api_v1 | |
| parent | 8e79387dd2f1172c3ee1f2aa4588ae71d21ea36d (diff) | |
Manufacture and category by ready stock
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/category.py | 4 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/manufacture.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/category.py b/indoteknik_api/controllers/api_v1/category.py index 585e3eda..792b59b2 100644 --- a/indoteknik_api/controllers/api_v1/category.py +++ b/indoteknik_api/controllers/api_v1/category.py @@ -17,6 +17,10 @@ class Category(controller.Controller): active_flash_sale = request.env['product.pricelist'].get_active_flash_sale() if active_flash_sale: category_ids = [x.id for item in active_flash_sale.item_ids for x in item.product_id.public_categ_ids] + elif page == 'ready-stock': + product_templates = request.env['product.template'].search([('virtual_qty', '>', 0)]) + if product_templates: + category_ids = [x.id for product in product_templates for x in product.public_categ_ids] elif page == 'manufacture': manufacture_id = kw.get('manufacture_id') if not manufacture_id: diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index ba2e3be9..135a6e5d 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -17,6 +17,10 @@ class Manufacture(controller.Controller): active_flash_sale = request.env['product.pricelist'].get_active_flash_sale() if active_flash_sale: manufacture_ids = [x.product_id.x_manufacture.id for x in active_flash_sale.item_ids] + elif page == 'ready-stock': + product_templates = request.env['product.template'].search([('virtual_qty', '>', 0)]) + if product_templates: + manufacture_ids = [x.x_manufacture.id for x in product_templates] elif page == 'category': category_id = kw.get('category_id') if not category_id: |
