summaryrefslogtreecommitdiff
path: root/indoteknik_api
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-08-10 05:02:39 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-08-10 05:02:39 +0000
commit9f8664c33429e41c6133ba2b325662245ffbc92d (patch)
treebce73d880f28edb48810fe263c8bcd717339b9be /indoteknik_api
parent1e3ea5f5df6794ffb5712389deca6d0d868cfc0a (diff)
parent659268250145b51e8700bc01871ae3bba34f76f3 (diff)
Merged in change/feature/voucher (pull request #96)
Change/feature/voucher
Diffstat (limited to 'indoteknik_api')
-rw-r--r--indoteknik_api/controllers/api_v1/voucher.py4
-rw-r--r--indoteknik_api/models/product_product.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/voucher.py b/indoteknik_api/controllers/api_v1/voucher.py
index 3a2c798e..0b769ee7 100644
--- a/indoteknik_api/controllers/api_v1/voucher.py
+++ b/indoteknik_api/controllers/api_v1/voucher.py
@@ -75,5 +75,7 @@ class Voucher(controller.Controller):
voucher['has_flashsale_products'] = has_flashsale_products
voucher['discount_voucher'] = discount_voucher
voucher['difference_to_apply'] = difference_to_apply
+
+ sorted_vouchers = sorted(vouchers, key=lambda x: x['can_apply'], reverse=True)
- return self.response(vouchers)
+ return self.response(sorted_vouchers)
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py
index ff7c6498..a2d2f8a2 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -55,8 +55,8 @@ class ProductProduct(models.Model):
product_promotions = program_line.get_active_promotions(self.id)
return True if len(product_promotions) > 0 else False
- def calculate_website_price(self):
- pricelist = self.env.user_pricelist
+ def calculate_website_price(self, pricelist=False):
+ pricelist = pricelist or self.env.user_pricelist
config = self.env['ir.config_parameter']
product_pricelist_tier1 = int(config.get_param('product.pricelist.tier1'))