[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) <abz@odoo.com>
This commit is contained in:
Achraf (abz)
2023-11-24 06:53:33 +00:00
parent 7406cf29b3
commit e72ae4be88
+3 -2
View File
@@ -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(