Which table store the total stock of a Product

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

Which table store the total stock of a Product

Postby smartjsp » Sun Jul 24, 2011 5:24 am

Hi everyone,

I am performing an integration between adempiere and a third party product using activemq and jms, so far things are going well ,and for that purpose I should send the product information including the total stock.
From my preliminary review, I have seen the stock information in the M_Storage table, and I saw 1 row per document, so if I want to get the total I have to summarize the product rows.

However, looking at the sales order window, when we choose the product to sell per line, there is a column with the summarized stock per product, is that information available in other adempiere table, or should I summarize this total from the M_storage each time that I need it ?


Pedro Rozo.
Posts: 44
Joined: Fri Mar 11, 2011 11:31 pm
Location: Bogota, Colombia

Re: Which table store the total stock of a Product

Postby hengsin » Sun Jul 24, 2011 9:02 am

yes, it is sum from M_Storage.
Posts: 37
Joined: Tue May 10, 2011 3:11 pm

Re: Which table store the total stock of a Product

Postby red1 » Thu Sep 22, 2011 4:26 am

In my implementation of the same here viewtopic.php?f=29&t=1356, I do not need to get the total stock but just the stock for that particular Warehouse Locator's 'Store'. Then i pass that store only OnHandQty as a message queue and the POS' has different locations which are regarded as an equivalent virtual store in the ERP. The POS synchronisation will check each record in the queue and accept only the one that says the same store location name and pick up that OnHandQty and ignore the rest.

The code to get the Store' OnHandQty is:
Code: Select all
      //get Storage Qty based on POS ID / OrgValue (this assumes that we cannot be sending Product that has no Storage
         int anyStorage = new Query(Env.getCtx(), MStorage.Table_Name, MStorage.COLUMNNAME_M_Product_ID+"=?", get_TrxName())
         if (anyStorage==0) continue;
               //the count will determine more XML details according to each storage (POS ID/Org) as separaet detail
               List<MStorage> stores = new Query(Env.getCtx(),MStorage.Table_Name,MStorage.COLUMNNAME_M_Product_ID+
         for (MStorage store:stores){
                  //Warehouse Name as POS name
                  //Storage Data - QtyOnHand

and the code to pic it up at the POS side is:
Code: Select all
        else if (column.equals("QtyOnHand"))

You can check out the projects complete coding in SVN to view its implementation by referring to the links in the above thread. A full PDF guide is also given.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 2 guests