From e72ae4be88fe51c87ea4789c43a1364ae107a14a Mon Sep 17 00:00:00 2001 From: "Achraf (abz)" Date: Wed, 22 Nov 2023 08:57:31 +0000 Subject: [PATCH] [FIX] website_sale: Allow users to checkout with a positive fixed_price Steps: - Install `website_sale` - Enable demo payment provider - Set a positive delivery fixed price - Go to /shop, add a product and checkout - Error "The cart has been updated, Please refresh the page" Because amount in kwargs in `shop_payment_transaction` was compared to `amount_total`to check the order but `amount_total` doesn't contains delivery cost unlike `amount` closes odoo/odoo#143404 X-original-commit: e79a35df5a62114d292c4357fe3e047c156d179b Signed-off-by: Achraf Ben Azzouz (abz) --- addons/website_sale/controllers/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 4100f567c88..444c42e3402 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -1988,10 +1988,11 @@ class PaymentPortal(payment_portal.PaymentPortal): 'currency_id': order_sudo.currency_id.id, 'sale_order_id': order_id, # Include the SO to allow Subscriptions to tokenize the tx }) + total = order_sudo.amount_total + order_sudo.amount_delivery if not kwargs.get('amount'): - kwargs['amount'] = order_sudo.amount_total + kwargs['amount'] = total - if tools.float_compare(kwargs['amount'], order_sudo.amount_total, precision_rounding=order_sudo.currency_id.rounding): + if tools.float_compare(kwargs['amount'], total, precision_rounding=order_sudo.currency_id.rounding): raise ValidationError(_("The cart has been updated. Please refresh the page.")) tx_sudo = self._create_transaction(