Browse Source

Nov 10: [FIX] Bug Fixed 'pos_restrict_product_stock'

pull/406/merge
Risvana Cybro 1 week ago
parent
commit
e68f5d1d68
  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. 24
      pos_restrict_product_stock/static/description/index.html
  5. 3
      pos_restrict_product_stock/static/src/js/OrderScreen.js
  6. 3
      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', 'name': 'Display Stock in POS | Restrict Out-of-Stock Products in POS',
'version': '18.0.1.0.0', 'version': '18.0.1.0.1',
'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""",

6
pos_restrict_product_stock/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 18.0.1.0.0 #### Version 18.0.1.0.0
#### ADD #### ADD
- Initial Commit for Display Stock in POS | Restrict Out-of-Stock Products in POS - Initial Commit for Display Stock in POS | Restrict Out-of-Stock Products in POS
#### 05.11.2025
#### Version 18.0.1.0.1
#### Update
- Service products and products measured in weight using “To Weigh In Scale” are now excluded from
restricts stock availability check in POS.

1
pos_restrict_product_stock/models/pos_session.py

@ -33,4 +33,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('type')
return result return result

24
pos_restrict_product_stock/static/description/index.html

@ -175,7 +175,29 @@
>Email Us</span >Email Us</span
> >
</a> </a>
<a href="skype:cybroopenerp?chat"
target="_blank"
style="
background-color: #7f289b;
font-family: Montserrat;
display: inline-block;
padding: 7px 33px;
border: 1px solid #7f289b;
border-radius: 35px;
text-decoration: none;
"
class="mx-1 mb-2 deep-1 deep_hover">
<img
class="img"
style="width: 24px"
src="./assets/icons/skype-fill.svg"
/>
<span
class="pl-2"
style="color: #fff; font-size: 16px; vertical-align: middle"
>Skype Us</span
>
</a>
</div> </div>
<div class="d-flex justify-content-center mt-2"> <div class="d-flex justify-content-center mt-2">
<img src="./assets/icons/hero.gif" <img src="./assets/icons/hero.gif"

3
pos_restrict_product_stock/static/src/js/OrderScreen.js

@ -12,8 +12,9 @@ patch(PosStore.prototype, {
const body = [] const body = []
const pro_id = false const pro_id = false
for (const line of this.get_order().get_orderlines()) { for (const line of this.get_order().get_orderlines()) {
// const isService = product.detailed_type === 'service';
if (line.config.is_restrict_product && ((type == 'qty_on_hand') && (line.product_id.qty_available <= 0)) | ((type == 'virtual_qty') && (line.product_id.virtual_available <= 0)) | if (line.config.is_restrict_product && ((type == 'qty_on_hand') && (line.product_id.qty_available <= 0)) | ((type == 'virtual_qty') && (line.product_id.virtual_available <= 0)) |
((line.product_id.qty_available <= 0) && (line.product_id.virtual_available <= 0))) { ((line.product_id.qty_available <= 0) && (line.product_id.virtual_available <= 0)) && (line.product_id.type != 'service' && (!(line.product_id.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.
body.push(line.product_id.display_name) body.push(line.product_id.display_name)
} }

3
pos_restrict_product_stock/static/src/js/ProductScreen.js

@ -13,8 +13,9 @@ setup() {
}, },
async addProductToOrder(...args) { async addProductToOrder(...args) {
var type = this.pos.config.stock_type var type = this.pos.config.stock_type
console.log("ar",args[0])
if (this.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (args['0'].qty_available <= 0)) | ((type == 'virtual_qty') && (args['0'].virtual_available <= 0)) | if (this.pos.config.is_restrict_product && ((type == 'qty_on_hand') && (args['0'].qty_available <= 0)) | ((type == 'virtual_qty') && (args['0'].virtual_available <= 0)) |
((args['0'].qty_available <= 0) && (args['0'].virtual_available <= 0))) { ((args['0'].qty_available <= 0) && (args['0'].virtual_available <= 0)) && (args['0'].type != 'service' && (!(args['0'].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.dialog.add(ConfirmationDialog, { this.dialog.add(ConfirmationDialog, {
body: _t("%s is out of stock. Do you want to proceed?", args['0'].display_name), body: _t("%s is out of stock. Do you want to proceed?", args['0'].display_name),

Loading…
Cancel
Save