diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-07-25 04:24:24 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-07-25 04:24:24 +0000 |
| commit | e933a05e9b03e489b581f27d1aa304774aafc320 (patch) | |
| tree | 4c0e32918e1ddf4e7a3e9116d3abb186ad417c7f /indoteknik_api/controllers/api_v1/voucher.py | |
| parent | 940054dbc1dffca75bfb81e478d5538f762009c6 (diff) | |
| parent | d454b715e7c7c31836cd525d9470b0eb3b1e7376 (diff) | |
Merged in feature/voucher-cart (pull request #67)
Feature/voucher cart
Diffstat (limited to 'indoteknik_api/controllers/api_v1/voucher.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/voucher.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/indoteknik_api/controllers/api_v1/voucher.py b/indoteknik_api/controllers/api_v1/voucher.py index a6a88cad..4baa93b7 100644 --- a/indoteknik_api/controllers/api_v1/voucher.py +++ b/indoteknik_api/controllers/api_v1/voucher.py @@ -31,9 +31,6 @@ class Voucher(controller.Controller): apply_status = '' products = checkout['products'] min_purchase_amount = voucher['min_purchase_amount'] - max_discount_amount = voucher['max_discount_amount'] - discount_type = voucher['discount_type'] - discount_amount = voucher['discount_amount'] can_apply = True difference_to_apply = 0 @@ -60,14 +57,8 @@ class Voucher(controller.Controller): apply_status = 'MPA' difference_to_apply = min_purchase_amount - subtotal - discount_voucher = 0 - if discount_type == 'fixed_price': - discount_voucher = discount_amount - if discount_type == 'percentage': - discount_voucher = subtotal * discount_amount / 100 - - if max_discount_amount > 0 and discount_voucher > max_discount_amount: - discount_voucher = max_discount_amount + obj_voucher = request.env['voucher'].browse(voucher['id']) + discount_voucher = obj_voucher.calculate_discount(subtotal) voucher['can_apply'] = can_apply voucher['apply_status'] = apply_status |
