summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2020-04-29 14:30:12 +0000
committerNicolas Martinelli <nim@odoo.com>2020-04-30 08:25:52 +0000
commit8d2fd05382705d4b3987ebac4c842d8507ede9cf (patch)
tree81cfe22d3225a17c392f09260b57efa33728c593 /addons
parent6290a2a9d987512ae3d7fe4397bddbdf91cbaf71 (diff)
[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#50437 X-original-commit: ec6f281f3cab0bb29e29fa60b125f158e91375c5 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_sale_stock/views/website_sale_stock_templates.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_sale_stock/views/website_sale_stock_templates.xml b/addons/website_sale_stock/views/website_sale_stock_templates.xml
index f0efc6744a2..cd010a29fff 100644
--- a/addons/website_sale_stock/views/website_sale_stock_templates.xml
+++ b/addons/website_sale_stock/views/website_sale_stock_templates.xml
@@ -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)">