diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-10 09:29:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-10 09:29:16 +0700 |
| commit | 2c7c774119f47025d1577cfa6b8c88e3cc5a0607 (patch) | |
| tree | 597727f2c48a18f06e862f044775b60dadcca2da /indoteknik_api/controllers/api_v1 | |
| parent | 7f0941a7c6fd75bd4aa79090da8fe70ba8575242 (diff) | |
deactivate api promotion type
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/promotion.py | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/indoteknik_api/controllers/api_v1/promotion.py b/indoteknik_api/controllers/api_v1/promotion.py index aca092af..61d06b28 100644 --- a/indoteknik_api/controllers/api_v1/promotion.py +++ b/indoteknik_api/controllers/api_v1/promotion.py @@ -29,50 +29,36 @@ class Promotion(controller.Controller): 'used_percentage': percent_remaining, }) - @http.route(prefix + 'program-line', auth='public', methods=['GET', 'OPTIONS']) - @controller.Controller.must_authorized() - def get_promotion_type(self, **kw): - type = kw.get('type') - program_line = request.env['promotion.program.line'].search([ - ("promotion_type", "=", type), - ("active", "=", True) - ]) - - if not type: - program_line = request.env['promotion.program.line'].search([("active", "=", True)]) - - data = [] - for line in program_line: - product_list = [] - for product in line.product_ids: - product_list.append({ - 'id': product.product_id.id, - 'name': product.product_id.name, - 'qty': product.qty - }) - free_product_list = [] - for free_product in line.product_ids: - free_product_list.append({ - 'id': free_product.product_id.id, - 'name': free_product.product_id.name, - 'qty': product.qty - }) - - data.append({ - 'id': line.id, - 'name': line.name, - 'program': line.program_id.name, - 'promotion_type': line.promotion_type, - 'active': line.active, - 'description': line.description, - 'package_limit': line.package_limit, - 'package_limit_user': line.package_limit_user, - 'package_limit_trx': line.package_limit_trx, - 'price': line.price, - 'products': product_list - }) + # @http.route(prefix + 'program-line', auth='public', methods=['GET', 'OPTIONS']) + # @controller.Controller.must_authorized() + # def get_promotion_type(self, **kw): + # type = kw.get('type') + # domain = [("active", "=", True)] + # if type: + # domain.append(("promotion_type", "=", type)) + + # program_lines = request.env['promotion.program.line'].search(domain, limit=100) + + # data = [{ + # 'id': line.id, + # 'name': line.name, + # 'program': line.program_id.name, + # 'promotion_type': line.promotion_type, + # 'active': line.active, + # 'description': line.description, + # 'package_limit': line.package_limit, + # 'package_limit_user': line.package_limit_user, + # 'package_limit_trx': line.package_limit_trx, + # 'price': line.price, + # 'products': [{ + # 'id': product.product_id.id, + # 'name': product.product_id.name, + # 'qty': product.qty + # } for product in line.product_ids] + # } for line in program_lines] + + # return self.response(data) - return self.response(data) @http.route(prefix + 'promotion/<id>', auth='public', methods=['GET']) @controller.Controller.must_authorized() |
