Skip to content
Snippets Groups Projects
Commit e1fb4f69 authored by Romain Derie's avatar Romain Derie
Browse files

[FIX] website_sale_stock: always select a warehouse


In multi-warehouses, the available quantities shown on product page is not the
same one used to compute the max quantity that can be bought in the checkout.

Indeed, a sale order has a required `warehouse_id` field, and the quantity that
can be bought is computed based on that warehouse.
But if the website has no warehouse set to it (in settings), the shown quantity
on product page will be computed based on all available warehouses.

It will then show an error on payment step, if the user has selected more
quantities than there is available on the warehouse used for his order.

Considering the structure of `sale.order`, displaying the quantities in
several warehouses does not make sense.

To reproduce the issue:
1. In Settings:
    - Enable 'Multi-Warehouses'
    - Make sure the option Website > Inventory > Warehouse in undefined
2. Create a second warehouse WH02
3. Update the quantity of "Storage Box":
    - 18 in first WH (should already be present)
    - 12 in WH02
4. Edit "Storage Box":
    - eCommerce > Availability: "Show inventory on website and prevent
sales if not enough stock"
5. On the eShop, go on "Storage Box"
    - Note that there are 30 units available
6. Add 22 "Storage Box" to the cart
7. Process checkout

Error: When trying to pay, a Server Error is raised: "We are not able to
redirect you to the payment form. You ask for 22.0 products but only
18.0 is available." This is confusing since the available quantity on
the product page is 30

opw-2630804

Part-of: odoo/odoo#77308
Co-authored-by: default avatarAdrien Widart <awt@odoo.com>
Co-authored-by: default avatarRomain Derie <rde@odoo.com>
parent c1e7b1ad
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment