[FIX] website_sale: get correct fiscal position
Make sure `force_company` context key is set on the SO in all cases. Indeed, when the context key is not properly set, an incorrect fiscal position can be retrieved in: https://github.com/odoo/odoo/blob/cc557f1e4de88466d0d159c5edf1a606a0c0bc6f/addons/account/models/partner.py#L99-L100 This is for example the case when we go through the route `/shop/confirm_order`. opw-2186682 closes odoo/odoo#44451 closes odoo/odoo#44933 Original-signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com> X-original-commit: 5691e733e2d860baa012140fc35d3f39ddf747c8 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -252,7 +252,7 @@ class Website(models.Model):
|
||||
sale_order_id = last_order.pricelist_id in available_pricelists and last_order.id
|
||||
|
||||
# Test validity of the sale_order_id
|
||||
sale_order = self.env['sale.order'].sudo().browse(sale_order_id).exists() if sale_order_id else None
|
||||
sale_order = self.env['sale.order'].with_company(request.website.company_id.id).sudo().browse(sale_order_id).exists() if sale_order_id else None
|
||||
|
||||
if not (sale_order or force_create or code):
|
||||
if request.session.get('sale_order_id'):
|
||||
|
||||
@@ -26,15 +26,9 @@ tour.register('shop_cart_recovery', {
|
||||
content: "check product is in cart, get cart id, logout, go to login",
|
||||
trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
|
||||
run: function () {
|
||||
rpc.query({
|
||||
'model': 'website',
|
||||
'method': 'sale_get_order',
|
||||
'args': [[$('html').data('website-id')]],
|
||||
}).then(function (data) {
|
||||
var orderId = parseInt(data.match(/sale\.order\((\d+),\)/)[1]);
|
||||
localStorage.setItem(orderIdKey, orderId);
|
||||
window.location.href = "/web/session/logout?redirect=/web/login";
|
||||
});
|
||||
var orderId = $('.my_cart_quantity').data('order-id');
|
||||
localStorage.setItem(orderIdKey, orderId);
|
||||
window.location.href = "/web/session/logout?redirect=/web/login";
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -51,14 +51,8 @@ tour.register('shop_mail', {
|
||||
content: "check product is in cart, get cart id, go to backend",
|
||||
trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
|
||||
run: function () {
|
||||
rpc.query({
|
||||
'model': 'website',
|
||||
'method': 'sale_get_order',
|
||||
'args': [[$('html').data('website-id')]],
|
||||
}).then(function (data) {
|
||||
var orderId = parseInt(data.match(/sale\.order\((\d+),\)/)[1]);
|
||||
window.location.href = "/web#action=sale.action_orders&view_type=form&id=" + orderId;
|
||||
});
|
||||
var orderId = $('.my_cart_quantity').data('order-id');
|
||||
window.location.href = "/web#action=sale.action_orders&view_type=form&id=" + orderId;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<li t-attf-class="nav-item o_wsale_my_cart #{'' if website_sale_order and website_sale_order.cart_quantity else 'd-none'}">
|
||||
<a href="/shop/cart" class="nav-link">
|
||||
<i class="fa fa-shopping-cart"></i>
|
||||
My Cart <sup t-attf-class="my_cart_quantity badge badge-primary" t-esc="website_sale_order and website_sale_order.cart_quantity or ''" />
|
||||
My Cart <sup t-attf-class="my_cart_quantity badge badge-primary" t-esc="website_sale_order and website_sale_order.cart_quantity or ''" t-att-data-order-id="website_sale_order and website_sale_order.id or ''"/>
|
||||
</a>
|
||||
</li>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user