diff --git a/pos_restrict_product_stock/__manifest__.py b/pos_restrict_product_stock/__manifest__.py index 8607e5c2e..41270feee 100644 --- a/pos_restrict_product_stock/__manifest__.py +++ b/pos_restrict_product_stock/__manifest__.py @@ -20,7 +20,7 @@ ############################################################################# { 'name': 'Display Stock in POS | Restrict Out-of-Stock Products in POS', - 'version': '17.0.2.1.1', + 'version': '17.0.2.1.2', 'category': 'Point of Sale', 'summary': """Enhance your Point of Sale experience by preventing the ordering of out-of-stock products during your session""", diff --git a/pos_restrict_product_stock/doc/RELEASE_NOTES.md b/pos_restrict_product_stock/doc/RELEASE_NOTES.md index b1f1b001e..eec8d06d5 100644 --- a/pos_restrict_product_stock/doc/RELEASE_NOTES.md +++ b/pos_restrict_product_stock/doc/RELEASE_NOTES.md @@ -9,4 +9,10 @@ #### Version 17.0.2.1.1 #### Update - Added a new feature that restricts stock availability when clicking the payment button. -This will help prevent the ordering of out-of-stock products, whether entered via barcode or through any other method. \ No newline at end of file +This will help prevent the ordering of out-of-stock products, whether entered via barcode or through any other method. + +#### 05.11.2025 +#### Version 17.0.2.1.2 +#### Update +Service products and products measured in kilograms with “To Weigh in Scale” enabled are now excluded from +restricts stock availability check in POS. \ No newline at end of file diff --git a/pos_restrict_product_stock/models/pos_session.py b/pos_restrict_product_stock/models/pos_session.py index bb529fb76..cf11c178e 100644 --- a/pos_restrict_product_stock/models/pos_session.py +++ b/pos_restrict_product_stock/models/pos_session.py @@ -33,6 +33,7 @@ class PosSession(models.Model): result = super()._loader_params_product_product() result['search_params']['fields'].append('qty_available') result['search_params']['fields'].append('virtual_available') + result['search_params']['fields'].append('detailed_type') # ❌ DO NOT add pos_stock_qty here (not a real field) return result diff --git a/pos_restrict_product_stock/static/src/js/OrderScreen.js b/pos_restrict_product_stock/static/src/js/OrderScreen.js index 7e44e6565..529af1071 100644 --- a/pos_restrict_product_stock/static/src/js/OrderScreen.js +++ b/pos_restrict_product_stock/static/src/js/OrderScreen.js @@ -24,6 +24,10 @@ patch(Order.prototype, { } for (const { product, total_qty, name } of Object.values(productQuantities)) { + if (product.detailed_type === 'service'|| product.uom_id[1]=="kg") { + console.log(product.type) + continue; + } if (is_restrict) { const qty_available = product.pos_stock_qty ?? product.qty_available; const virtual_qty = product.virtual_available; diff --git a/pos_restrict_product_stock/static/src/js/ProductScreen.js b/pos_restrict_product_stock/static/src/js/ProductScreen.js index 5e1d77c54..757d2ece3 100644 --- a/pos_restrict_product_stock/static/src/js/ProductScreen.js +++ b/pos_restrict_product_stock/static/src/js/ProductScreen.js @@ -8,10 +8,12 @@ import { _t } from "@web/core/l10n/translation"; patch(PosStore.prototype, { async addProductToCurrentOrder(...args) { const product = args[0]; + if (product.detailed_type === 'service'|| product.uom_id[1]=="kg") { + return super.addProductToCurrentOrder(...args); + } const type = this.config.stock_type; const order = this.get_order(); const selected_orderline = order.get_selected_orderline(); - let order_quantity = 1; if (selected_orderline && selected_orderline.product.id === product.id) { order_quantity = selected_orderline.quantity + 1;