[FIX] nfu_ecommerce: Drop session if SO belongs to another website (Odoo 16 bug)

This commit is contained in:
Niels Göttsch 2025-08-27 12:32:52 +02:00 committed by madmooose
parent bd15243732
commit bf3eed8669
5 changed files with 25 additions and 2 deletions

View file

@ -54,6 +54,7 @@ Changelog
:1.4.0: Add credit warning and avoid debts option :1.4.0: Add credit warning and avoid debts option
:1.4.1: Add credit to portal details :1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values :1.4.2: Catch unescaped float values
:1.4.3: Drop session if SO belongs to another website (Odoo 16 bug)
Bug Tracker Bug Tracker
=========== ===========

View file

@ -4,7 +4,7 @@
"author": "BAKEUP", "author": "BAKEUP",
"website": "https://www.bakeup.org", "website": "https://www.bakeup.org",
"category": "website", "category": "website",
"version": "16.0.1.4.2", "version": "16.0.1.4.3",
"depends": [ "depends": [
"sale_product_configurator", "sale_product_configurator",
"website_sale", "website_sale",

View file

@ -1,4 +1,5 @@
from odoo import fields, models from odoo import fields, models
from odoo.http import request
class Website(models.Model): class Website(models.Model):
@ -10,3 +11,21 @@ class Website(models.Model):
help="When the credit of a customer is lower than the warning level the credit is shown in red on the website.", help="When the credit of a customer is lower than the warning level the credit is shown in red on the website.",
) )
avoid_depts = fields.Boolean(string="Avoid depths") avoid_depts = fields.Boolean(string="Avoid depths")
def sale_get_order(self, force_create=False, update_pricelist=False):
"""Override to clean sale_order_id if so belongs to another website"""
self.ensure_one()
self = self.with_company(self.company_id)
SaleOrder = self.env["sale.order"].sudo()
sale_order_id = request.session.get("sale_order_id")
if sale_order_id:
sale_order = SaleOrder.browse(sale_order_id).exists()
if sale_order and sale_order.website_id != self:
request.session.pop("sale_order_id")
return super().sale_get_order(
force_create=force_create, update_pricelist=update_pricelist
)

View file

@ -9,4 +9,5 @@
:1.3.2: Add decimal to ribbon :1.3.2: Add decimal to ribbon
:1.4.0: Add credit warning and avoid debts option :1.4.0: Add credit warning and avoid debts option
:1.4.1: Add credit to portal details :1.4.1: Add credit to portal details
:1.4.2: Catch unescaped float values :1.4.2: Catch unescaped float values
:1.4.3: Drop session if SO belongs to another website (Odoo 16 bug)

View file

@ -425,6 +425,8 @@ adjustes the uom quantitiy</li>
</tr> </tr>
<tr class="field"><th class="field-name">1.4.2:</th><td class="field-body">Catch unescaped float values</td> <tr class="field"><th class="field-name">1.4.2:</th><td class="field-body">Catch unescaped float values</td>
</tr> </tr>
<tr class="field"><th class="field-name">1.4.3:</th><td class="field-body">Drop session if SO belongs to another website (Odoo 16 bug)</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>