diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-04 16:09:27 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-04 16:09:27 +0700 |
| commit | a724abaeb7b4f2a2b801b2583776133b5a1adbaa (patch) | |
| tree | c9622cfb587d330fe49b51ab3cc896413b7951b9 /indoteknik_api/controllers/api_v1/voucher.py | |
| parent | e415998452e34856e8fb609b677b76f9cfa7b884 (diff) | |
| parent | 2421dad6c88900949bc2891bc25006ffa838dd78 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_api/controllers/api_v1/voucher.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/voucher.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_api/controllers/api_v1/voucher.py b/indoteknik_api/controllers/api_v1/voucher.py index f82e1aef..3a2c798e 100644 --- a/indoteknik_api/controllers/api_v1/voucher.py +++ b/indoteknik_api/controllers/api_v1/voucher.py @@ -12,6 +12,7 @@ class Voucher(controller.Controller): cart = request.env['website.user.cart'] code = kw.get('code') user_id = kw.get('user_id') + source = kw.get('source') visibility = ['public'] parameter = [] @@ -25,7 +26,7 @@ class Voucher(controller.Controller): parameter += [('visibility', 'in', visibility)] vouchers = request.env['voucher'].get_active_voucher(parameter) vouchers = vouchers.res_format() - checkout = cart.get_user_checkout(user_id) + checkout = cart.get_user_checkout(user_id, source=source) for voucher in vouchers: apply_status = '' @@ -43,7 +44,7 @@ class Voucher(controller.Controller): quantity = product['quantity'] manufacture_id = product['manufacture']['id'] or False - if len(manufacture_ids) == 0 or (not product['has_flashsale'] and manufacture_id in manufacture_ids): + if len(manufacture_ids) == 0 or manufacture_id in manufacture_ids: has_match_manufacture = True if product['has_flashsale']: @@ -58,6 +59,8 @@ class Voucher(controller.Controller): apply_status = 'UM' # Unqualified Manufacture elif subtotal < min_purchase_amount: apply_status = 'MPA' # Minimum Purchase Amount + if has_flashsale_products: + apply_status += '-HF' # Has Flashsale else: can_apply = True |
