[FIX] website_sale: handle free SO
When a sale order is free, no transaction are created but you are redirected to the page '/shop/confirmation' that display a transaction and lead to bad displaying because there are no transaction. To fix this behaviour, we redirect to the portal view of this sale order. We've also added the 'href=#' on the button link to have it written in white. closes odoo/odoo#33019 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -969,6 +969,9 @@ class WebsiteSale(ProductConfiguratorController):
|
||||
if not order or (order.amount_total and not tx):
|
||||
return request.redirect('/shop')
|
||||
|
||||
if order and not order.amount_total and not tx:
|
||||
return request.redirect(order.get_portal_url())
|
||||
|
||||
# clean context and session, then redirect to the confirmation page
|
||||
request.website.sale_reset()
|
||||
if tx and tx.state == 'draft':
|
||||
|
||||
@@ -1364,7 +1364,7 @@
|
||||
<div class="js_payment mt-3" t-if="not website_sale_order.amount_total" id="payment_method">
|
||||
<form target="_self" action="/shop/payment/validate" method="post" class="float-right">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
|
||||
<a role="button" class="btn btn-primary a-submit">
|
||||
<a role="button" class="btn btn-primary a-submit" href="#">
|
||||
<span t-if="order.amount_total > 0">Pay Now <span class="fa fa-chevron-right"></span></span>
|
||||
<span t-if="order.amount_total == 0">Confirm Order <span class="fa fa-chevron-right"></span></span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user