Browse Source

Nov 13: [FIX] Bug Fixed 'pos_restrict_product_stock'

pull/345/merge
Cybrosys Technologies 6 months ago
parent
commit
54c94ee72f
  1. 2
      pos_restrict_product_stock/__manifest__.py
  2. 6
      pos_restrict_product_stock/doc/RELEASE_NOTES.md
  3. 26
      pos_restrict_product_stock/static/src/js/ProductScreen.js
  4. 5
      pos_restrict_product_stock/static/src/js/RestrictStockPopup.js

2
pos_restrict_product_stock/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Display Stock in POS | Restrict Out-of-Stock Products in POS',
'version': '16.0.2.1.1',
'version': '16.0.2.2.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

@ -16,3 +16,9 @@ multiple warehouse
#### ADD
- Code updated. that quantity and forcast quantity would be updated in real time when a pos order was confirmed when
Also Changed the quantity visible for service product
#### 11.11.2024
#### Version 16.0.2.2.2
#### 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.

26
pos_restrict_product_stock/static/src/js/ProductScreen.js

@ -21,5 +21,31 @@ const RestrictProductScreen = (ProductScreen) => class RestrictProductScreen ext
await super._clickProduct(event)
}
}
async _onClickPay() {
var type = this.env.pos.config.stock_type
const pay = true
const body = []
const pro_id = false
for (const line of this.env.pos.selectedOrder.orderlines) {
if (line.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (line.product.qty_available <= 0)) | ((type == 'virtual_qty') && (line.product.virtual_available <= 0)) |
((line.product.qty_available <= 0) && (line.product.virtual_available <= 0))) {
// If the product restriction is activated in the settings and quantity is out stock, it show the restrict popup.
body.push(line.product.display_name)
}
}
if (body.length > 0) { // Check if body has items
const confirmed = await this.showPopup("RestrictStockPopup", {
body: body,
pro_id: pro_id
});
if (confirmed == true) {
return super._onClickPay(...arguments);// Proceed with payment
} else {
return ;
}
} else {
return super._onClickPay(...arguments); // No restrictions, proceed with payment
}
}
}
Registries.Component.extend(ProductScreen, RestrictProductScreen);

5
pos_restrict_product_stock/static/src/js/RestrictStockPopup.js

@ -8,9 +8,12 @@ import Registries from 'point_of_sale.Registries';
class RestrictStockPopup extends AbstractAwaitablePopup {
_OrderProduct() {
// On clicking order product button on popup, it will add product to orderline
if (this.props.pro_id){
var product = this.env.pos.db.get_product_by_id(this.props.pro_id)
this.env.pos.selectedOrder.add_product(product);
this.cancel();
}
this.props.resolve(true);
this.cancel();
}
}
RestrictStockPopup.template = 'RestrictStockPopup';

Loading…
Cancel
Save