Browse Source

Nov 13: [FIX] Bug Fixed 'pos_restrict_product_stock'

17.0
Risvana Cybro 3 days ago
parent
commit
b6be068763
  1. 2
      pos_restrict_product_stock/__manifest__.py
  2. 6
      pos_restrict_product_stock/doc/RELEASE_NOTES.md
  3. 1
      pos_restrict_product_stock/models/pos_session.py
  4. 4
      pos_restrict_product_stock/static/src/js/OrderScreen.js
  5. 4
      pos_restrict_product_stock/static/src/js/ProductScreen.js

2
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""",

6
pos_restrict_product_stock/doc/RELEASE_NOTES.md

@ -10,3 +10,9 @@
#### 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.
#### 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.

1
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

4
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;

4
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;

Loading…
Cancel
Save