コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2910 ビュー

Hi

how to add quantity in view tree of product for a specific  location

I use this code

 def _default_stock_location(self, cr, uid, context=None):       
        location_obj = self.pool.get('stock.location')
        count = location_obj.search(cr, uid, [('company_id', '=', 'sousse1')], context=context)  
        for a in count:
            record=location_obj.browse(cr, uid, a, context=context).stock_real
        return record

_colmuns= {'sousse1' : fields.float('Sousse1'), }

_defaults={'sousse1":_default_stock_location}

Thanks

アバター
破棄
最善の回答

you can use this code to get product quantity of any location by its id:

context1.update({'states': ['done'], 'what': ('in', 'out'), 'location': 18})

result = prod_obj_pool.get_product_available(cr, uid, [obj.product_id.id], context=context1)

Give location id and product id.

アバター
破棄
著作者

Thanks for your reply where can i use this code,can you give me a function.

著作者

plzz help

can you please give more details of your need???

著作者

I have one location for each company my question is how to display for example the quantity of stock for company "sousse1" in my view tree of model product.product. thanks.