diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-03 15:34:12 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-03 15:34:12 +0700 |
| commit | 4aa474f3ced6681a1dfd5ec48806eb690e31c3d8 (patch) | |
| tree | d1dfdaea2768c47e3a53b4fed59223082cbe9481 /indoteknik_api/controllers/api_v1/manufacture.py | |
| parent | 76ccac9630b60ca3774eb83fb13f1a89ee3cabf1 (diff) | |
Rest API Promotion
Diffstat (limited to 'indoteknik_api/controllers/api_v1/manufacture.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/manufacture.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index 135a6e5d..3cb7b70c 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -1,6 +1,7 @@ from .. import controller from odoo import http from odoo.http import request +import ast class Manufacture(controller.Controller): @@ -27,8 +28,15 @@ class Manufacture(controller.Controller): return self.response(code=400, description='category_id is required') product_variants = request.env['product.product'].search([('public_categ_ids', '=', int(category_id))]) manufacture_ids = [x.x_manufacture.id for x in product_variants] + elif page == 'promotion': + promotion_id = kw.get('promotion_id') + if not promotion_id: + return self.response(code=400, description='promotion_id is required') + coupon_program = request.env['coupon.program'].search([('id', '=', promotion_id)]) + product_variants = request.env['product.product'].search(ast.literal_eval(coupon_program.rule_products_domain)) + manufacture_ids = [x.x_manufacture.id for x in product_variants] else: - return self.response(code=400, description='page possible value is flash-sale, category') + return self.response(code=400, description='page possible value is flash-sale, ready-stock, category, promotion') manufactures = request.env['x_manufactures'].search([('id', 'in', manufacture_ids)]) data = [] |
