[FIX] website_sale: the pricelist is reset when the address is edited

Expected behavior : The pricelist must be the one chosen by the customer on the website.

Current behavior : The price list is reset when the address is edited

Steps to reproduce the error :
First of all, you need to setup 2 pricelists on the website:
~ The first in dollars
~ The second in euros
~ Removes the group of countries from both

1. Create an order with the second price list (EURO)
2. Set your address
3. Edit your address
4. The pricelist will be changed to dollars

When you set the address for the first time, It redirects to /shop/confirm_order which
executes sale_get_order(update_pricelist=True) to correct the price list.

But when you edit the address sale_get_order(update_pricelist=True) is not  executed

closes odoo/odoo#83061

closes odoo/odoo#86764

X-original-commit: e5a76880320ce0606e6a0fc2a6ba776f79ce126e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Manuel Gómez - https://www.vauxoo.com/
2022-03-22 09:37:50 +01:00
committed by imanie383
parent c490f6fef0
commit 2f4ac2a035
+4
View File
@@ -835,6 +835,10 @@ class WebsiteSale(http.Controller):
if not kw.get('use_same'):
kw['callback'] = kw.get('callback') or \
(not order.only_services and (mode[0] == 'edit' and '/shop/checkout' or '/shop/address'))
# We need to update the pricelist(by the one selected by the customer), because onchange_partner reset it
# We only need to update the pricelist when it is not redirected to /confirm_order
if kw.get('callback', '') != '/shop/confirm_order':
request.website.sale_get_order(update_pricelist=True)
elif mode[1] == 'shipping':
order.partner_shipping_id = partner_id