Skip to content
Snippets Groups Projects
Commit ec6f281f authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] website_sale_stock: prevent buying consumable


- In Website > Settings, set 'Show inventory on website and prevent
  sales if not enough stock'
- Create a consumable product P, publish on the eCommerce
- As user 1, buy 1 units of P => validate the SO => 1 unit is reserved
- As user 2, add 1 unit of P to the cart. In the cart click on the `+`
  to add a unit

The product is removed from the cart.

This happens because `virtual_available` quantity is taken into account,
while it shouldn't be since it is a consumable.

opw-2245075

closes odoo/odoo#50401

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 0a8ce61f
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
<!-- Shopping Cart Lines -->
<template id="website_sale_stock_cart_lines" inherit_id="website_sale.cart_lines" name="Shopping Cart Lines">
<xpath expr="//input[@type='text'][hasclass('quantity')]" position="attributes">
<attribute name='t-att-data-max'>(line.product_uom_qty + (line.product_id.virtual_available - line.product_id.cart_qty)) if line.product_id.inventory_availability in ['always', 'threshold'] else None</attribute>
<attribute name='t-att-data-max'>(line.product_uom_qty + (line.product_id.virtual_available - line.product_id.cart_qty)) if line.product_id.type == 'product' and line.product_id.inventory_availability in ['always', 'threshold'] else None</attribute>
</xpath>
<xpath expr="//div[hasclass('css_quantity')]//i[hasclass('fa-plus')]/.." position="replace">
<t t-if="line._get_stock_warning(clear=False)">
......
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