It is currently Tue May 22, 2012 10:58 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: where they calculate available stock in source code ?
PostPosted: Thu Apr 21, 2011 3:23 pm 
Offline

Joined: Tue Jun 16, 2009 6:08 am
Posts: 105
Hi,

We found the below function in product.py file, But we couldn't understand, how they calculating the stock availability ?

Code:
def _get_product_available_func(states, what):
        def _product_available(self, cr, uid, ids, name, arg, context=None):
            return {}.fromkeys(ids, 0.0)
        return _product_available


Any suggestions ?

Thanks..


Top
 Profile  
 
 Post subject: Re: where they calculate available stock in source code ?
PostPosted: Fri Apr 22, 2011 5:23 am 
Offline

Joined: Tue Jun 16, 2009 6:08 am
Posts: 105
We found ourself...

in stock/product.py

Code:
if date_values:
            where.append(tuple(date_values))
        if 'in' in what:
            # all moves from a location out of the set to a location in the set
            cr.execute(
                'select sum(product_qty), product_id, product_uom '\
                'from stock_move '\
                'where location_id NOT IN %s'\
                'and location_dest_id IN %s'\
                'and product_id IN %s'\
                'and state IN %s' + (date_str and 'and '+date_str+' ' or '') +''\
                'group by product_id,product_uom',tuple(where))
            results = cr.fetchall()
        if 'out' in what:
            # all moves from a location in the set to a location out of the set
            cr.execute(
                'select sum(product_qty), product_id, product_uom '\
                'from stock_move '\
                'where location_id IN %s'\
                'and location_dest_id NOT IN %s '\
                'and product_id  IN %s'\
                'and state in %s' + (date_str and 'and '+date_str+' ' or '') + ''\
                'group by product_id,product_uom',tuple(where))
            results2 = cr.fetchall()



Thanks....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP