Browse Source

:Dec 15 [FIX] Bug Fixed 'pos_restrict_product_stock'

15.0
Risvana Cybro 1 week ago
parent
commit
78d1e8f963
  1. 4
      pos_restrict_product_stock/__manifest__.py
  2. 7
      pos_restrict_product_stock/doc/RELEASE_NOTES.md
  3. 1
      pos_restrict_product_stock/models/__init__.py
  4. 1
      pos_restrict_product_stock/models/pos_session.py
  5. 2
      pos_restrict_product_stock/models/product_product.py
  6. 6
      pos_restrict_product_stock/static/src/js/ProductScreen.js

4
pos_restrict_product_stock/__manifest__.py

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
{ {
'name': 'Display Stock in POS | Restrict Out-of-Stock Products in POS', 'name': 'Display Stock in POS | Restrict Out-of-Stock Products in POS',
'version': '15.0.1.0.0', 'version': '15.0.1.0.2',
'category': 'Point of Sale', 'category': 'Point of Sale',
'summary': "Enhance your Point of Sale experience by preventing the " 'summary': "Enhance your Point of Sale experience by preventing the "
"ordering of out-of-stock products during your session", "ordering of out-of-stock products during your session",
@ -35,7 +35,7 @@
'website': 'https://www.cybrosys.com', 'website': 'https://www.cybrosys.com',
'depends': ['point_of_sale'], 'depends': ['point_of_sale'],
'data': [ 'data': [
'views/pos_config_views.xml' 'views/pos_config_views.xml',
], ],
'assets': { 'assets': {
'point_of_sale.assets': [ 'point_of_sale.assets': [

7
pos_restrict_product_stock/doc/RELEASE_NOTES.md

@ -9,3 +9,10 @@
#### Version 15.0.1.0.1 #### Version 15.0.1.0.1
### UPDT ### UPDT
- Restricted payment if an item in the order is out of stock.Update product stock without refreshing the page. - Restricted payment if an item in the order is out of stock.Update product stock without refreshing the page.
#### 06.11.2025
#### Version 15.0.1.0.2
### UPDT
- Service products and products measured with “To Weigh in Scale” enabled are now excluded from
Restrict Product Out of Stock in POS.

1
pos_restrict_product_stock/models/__init__.py

@ -21,3 +21,4 @@
############################################################################### ###############################################################################
from . import pos_config from . import pos_config
from . import product_product from . import product_product
from . import pos_session

1
pos_restrict_product_stock/models/pos_session.py

@ -34,4 +34,5 @@ class PosSession(models.Model):
result = super()._loader_params_product_product() result = super()._loader_params_product_product()
result['search_params']['fields'].append('qty_available') result['search_params']['fields'].append('qty_available')
result['search_params']['fields'].append('virtual_available') result['search_params']['fields'].append('virtual_available')
result['search_params']['fields'].append('detailed_type')
return result return result

2
pos_restrict_product_stock/models/product_product.py

@ -32,5 +32,5 @@ class ProductProduct(models.Model):
Retrieves a list of products that are available in the Point of Sale (POS) system, Retrieves a list of products that are available in the Point of Sale (POS) system,
including their current available quantity and virtual available quantity. including their current available quantity and virtual available quantity.
""" """
products= self.search_read([('available_in_pos','=',True)],fields=['id', 'qty_available','virtual_available']) products= self.search_read([('available_in_pos','=',True)],fields=['id', 'qty_available','virtual_available','detailed_type'])
return products return products

6
pos_restrict_product_stock/static/src/js/ProductScreen.js

@ -6,14 +6,14 @@ import Registries from 'point_of_sale.Registries';
import ProductScreen from 'point_of_sale.ProductScreen'; import ProductScreen from 'point_of_sale.ProductScreen';
import { Gui } from 'point_of_sale.Gui'; import { Gui } from 'point_of_sale.Gui';
var models = require('point_of_sale.models'); var models = require('point_of_sale.models');
models.load_fields('product.product', ['qty_available','virtual_available']); models.load_fields('product.product', ['qty_available','virtual_available','detailed_type']);
const RestrictProductScreen = (ProductScreen) => class RestrictProductScreen extends ProductScreen { const RestrictProductScreen = (ProductScreen) => class RestrictProductScreen extends ProductScreen {
async _clickProduct(event) { async _clickProduct(event) {
// Overriding product item click to restrict product out of stock // Overriding product item click to restrict product out of stock
const product = event.detail; const product = event.detail;
var type = this.env.pos.config.stock_type var type = this.env.pos.config.stock_type
if (this.env.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (product.qty_available <= 0)) | ((type == 'virtual_qty') && (product.virtual_available <= 0)) | if (this.env.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (product.qty_available <= 0)) | ((type == 'virtual_qty') && (product.virtual_available <= 0)) |
((product.qty_available <= 0) && (product.virtual_available <= 0))) { ((product.qty_available <= 0) && (product.virtual_available <= 0)) && (product.detailed_type != 'service' && (!(product.to_weight)))) {
// If the product restriction is activated in the settings and quantity is out stock, it show the restrict popup. // If the product restriction is activated in the settings and quantity is out stock, it show the restrict popup.
this.showPopup("RestrictStockPopup", { this.showPopup("RestrictStockPopup", {
body: product.display_name, body: product.display_name,
@ -29,7 +29,7 @@ const RestrictProductScreen = (ProductScreen) => class RestrictProductScreen ext
var out_of_stock = false var out_of_stock = false
for (let rec of this.env.pos.get_order().orderlines.models) { for (let rec of this.env.pos.get_order().orderlines.models) {
if (this.env.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (rec.quantity > rec.product.qty_available)) | ((type == 'virtual_qty') && (rec.quantity > rec.product.virtual_available)) | if (this.env.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (rec.quantity > rec.product.qty_available)) | ((type == 'virtual_qty') && (rec.quantity > rec.product.virtual_available)) |
((rec.quantity > rec.product.qty_available) && (rec.quantity > rec.product.virtual_available))) { ((rec.quantity > rec.product.qty_available) && (rec.quantity > rec.product.virtual_available)) && (rec.product.detailed_type != 'service' && (!(rec.product.to_weight)))) {
out_of_stock = true out_of_stock = true
this.showPopup("OutOfStockPopup", { this.showPopup("OutOfStockPopup", {
body: rec.product.display_name, body: rec.product.display_name,

Loading…
Cancel
Save