diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-07-01 15:55:28 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-07-01 15:59:51 +0200 |
| commit | bdf980e4b462d674b4e7bf647f526beb32a2ad07 (patch) | |
| tree | 06cb5f549b92f586722a901d553d9b4580b14655 | |
| parent | 49f2514a9d71f13fcc718fe326ba2e8e76ef0e28 (diff) | |
[FIX] stock_account: stock valuation report without result
This is related to rev. 55b7f15ee2427e4c99edf05a5a61b069a5395bab
Prevent crash when there is no line to display
in the stock valuation report
Reporting > Warehouse > Stock Valuation.
Like when there is not yet any data, or the filter gives no result
opw-643748
| -rw-r--r-- | addons/stock_account/wizard/stock_valuation_history.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 66b670c2a75..13e35c7b91d 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -56,8 +56,10 @@ class stock_history(osv.osv): for product_id in ids: line_ids.add(product_id) line_ids = list(line_ids) - cr.execute('SELECT id, product_id, price_unit_on_quant, company_id, quantity FROM stock_history WHERE id in %s', (tuple(line_ids),)) - lines_rec = cr.dictfetchall() + lines_rec = {} + if line_ids: + cr.execute('SELECT id, product_id, price_unit_on_quant, company_id, quantity FROM stock_history WHERE id in %s', (tuple(line_ids),)) + lines_rec = cr.dictfetchall() lines_dict = dict((line['id'], line) for line in lines_rec) product_ids = list(set(line_rec['product_id'] for line_rec in lines_rec)) products_rec = self.pool['product.product'].read(cr, uid, product_ids, ['cost_method', 'product_tmpl_id'], context=context) |
