-
- Downloads
[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:Adrien Widart <awt@odoo.com> Co-authored-by:
Romain Derie <rde@odoo.com>
Showing
- addons/website_sale_stock/models/product_template.py 1 addition, 1 deletionaddons/website_sale_stock/models/product_template.py
- addons/website_sale_stock/models/website.py 9 additions, 6 deletionsaddons/website_sale_stock/models/website.py
- addons/website_sale_stock/tests/test_website_sale_stock_product_warehouse.py 48 additions, 42 deletions..._stock/tests/test_website_sale_stock_product_warehouse.py
Loading
Please register or sign in to comment