Commit 7cb73d4
committed
[FIX] website_sale: prevent error when changing the delivery address
Currently, an error occurs when the user changing the delivery address in
the website.
Steps to reproduce:
- Install the website_sale module and enable the Demo payment provider.
- Go to Website > Shop > Add a product to Cart > View cart > Checkout.
- Ensure there are at least two different delivery addresses > Confirm > Pay now.
- Quickly press the browser’s back button twice.
- Select a different delivery address.
Error:
ValueError: Expected singleton: sale.order()
Root Cause:
At [1], the code calls order.ensure_one(). When the cart (sale.order) is empty,
leads to an error.
Fix:
This commit prevents a traceback on the frontend when a user attempts to
change the delivery address and safely redirects them to the shop page.
[1]:
https://github.com/odoo/odoo/blob/88c9a45ee1ff8dde871865723c3387c059af8289/addons/delivery/models/delivery_carrier.py#L157
sentry-6869972801
closes odoo#233326
X-original-commit: 2b57313
Signed-off-by: Valentin Chevalier <[email protected]>
Signed-off-by: Utsav Maru (utma) <[email protected]>1 parent 27b0568 commit 7cb73d4
1 file changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
36 | 55 | | |
37 | 56 | | |
38 | 57 | | |
| |||
0 commit comments