Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odgovori
1021 Prikazi

i need to show the quantity of product in the product cards in real time. suppose am in pos and another user make sale from sale module and delivered quantity (meaning deduct stock in warehouse) if the current quantity was 10 this should immediately change to 9
am using this span tag to render the value

<t t-name ="point_of_sale.ProductCard" t-inherit ="point_of_sale.ProductCard" 
t-inherit-mode ="extension" >
<xpath expr ="//div[hasclass('product-information-tag')]" position ="after" >
<t t-if ="this.env.services.pos.config.is_display_stock" >
<div class ="warehouse-stock" >
<div class ="display-qty" >
<span class ="warehouse-name" > Total : </span>
<span class ="stock-quantity" ><t t-esc ="this.env.services.pos.db.product_by_id[props.productId].qty_available" /></span>
</div>
</div>
Avatar
Opusti
Best Answer

Hello Anthony,

The inventory levels in the POS can be refreshed in real time. The on-hand count will change as sales occur through the Sales or POS module.

You can turn on this option in the shop settings.

Avatar
Opusti
Best Answer

Hii,

Real-time Auto Update Using Long Polling (Custom Backend Required)

You need a custom module to:

  1. Create a server-side bus.bus listener using Odoo’s longpolling.
  2. When a stock move (delivery, sales order, etc.) happens, it sends a bus message to all POS sessions.
  3. On the JS side, receive the message and update qty_available in the in-memory pos.db.

This is similar to how Odoo's chat system or IoT box updates work.

Key steps:

  • Backend Python: send bus message on stock.quant change.
  • Frontend JS (POS): subscribe to bus and update product quantities.


Avatar
Opusti
Best Answer

Hi,


Please take a look at the following OCA module to see the quantity of available products in the POS.

*  https://odoo-community.org/shop/point-of-sale-stock-available-online-12436?search=pos_stock_available_online#attr=24980


Hope it helps

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
3
jul. 25
1298
0
jun. 24
1307
1
maj 24
1453
0
jul. 25
507
2
jul. 25
35