Skip to content
Snippets Groups Projects
Commit a170fb29 authored by Florent de Labarre's avatar Florent de Labarre
Browse files

[FIX] website_sale_delivery: prevent free shipping


Steps to reproduce:
- create a carrier with a fixed price (1) in the backend
- go to website
- add a product (2) in cart, process checkout and arrive in the payment page
- select the carrier
- the total price is now (1) + (2) which is correct
- in a separate browser tab, add another product (3) in cart, then click on
  continue shopping
- go back to previous browser tab and click on Pay Now
- the total price is now (2) + (3) which is not correct, the delivery cost is
  missing (it was removed due to second tab operations)

closes odoo/odoo#65474

Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
parent 9d3d1949
Branches
Tags
No related merge requests found
......@@ -53,14 +53,20 @@ tour.register('shop_buy_product', {
trigger: '#cart_products tr:contains("Storage Box") a.js_add_cart_json:first',
},
{
content: "set one",
content: "set three",
extra_trigger: '#wrap:not(:has(#cart_products tr:contains("Storage Box")))',
trigger: '#cart_products input.js_quantity',
run: 'text 1',
run: 'text 3',
},
{
content: "check amount",
// wait for cart_update_json to prevent concurrent update
trigger: '#order_total span.oe_currency_value:contains("49.50")',
run: function () {}, // it's a check
},
{
content: "go to checkout",
extra_trigger: '#cart_products input.js_quantity:propValue(1)',
extra_trigger: '#cart_products input.js_quantity:propValue(3)',
trigger: 'a[href*="/shop/checkout"]',
},
{
......
......@@ -4,7 +4,7 @@
from odoo import http, _
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.exceptions import UserError
from odoo.exceptions import UserError, ValidationError
class WebsiteSaleDelivery(WebsiteSale):
......@@ -22,6 +22,13 @@ class WebsiteSaleDelivery(WebsiteSale):
return super(WebsiteSaleDelivery, self).payment(**post)
@http.route()
def payment_transaction(self, *args, **kwargs):
order = request.website.sale_get_order()
if not order.is_all_service and not order.delivery_set:
raise ValidationError(_('There is an issue with your delivery method. Please refresh the page and try again.'))
return super().payment_transaction(*args, **kwargs)
@http.route(['/shop/update_carrier'], type='json', auth='public', methods=['POST'], website=True, csrf=False)
def update_eshop_carrier(self, **post):
order = request.website.sale_get_order()
......
......@@ -123,6 +123,13 @@ msgid ""
"refresh the page and try again."
msgstr ""
#. module: website_sale_delivery
#: code:addons/website_sale_delivery/controllers/main.py:0
#, python-format
msgid ""
"There is an issue with your delivery method. Please refresh the page and try again."
msgstr ""
#. module: website_sale_delivery
#: model:ir.model.fields,field_description:website_sale_delivery.field_delivery_carrier____last_update
#: model:ir.model.fields,field_description:website_sale_delivery.field_res_country____last_update
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment