From 5abb0e9b48ad2bdd5bfdc30716ae339b32574268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2?= Date: Wed, 25 Apr 2012 09:20:05 +0200 Subject: [PATCH] [FIX] stock: check if currency on product or picking exists bzr revid: nel@tinyerp.com-20120425072005-8dw7gqcmwp0jz3zb --- addons/stock/wizard/stock_partial_picking.py | 6 +++--- addons/stock/wizard/stock_return_picking.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index 6f815413497..3843965594b 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -103,10 +103,10 @@ class stock_partial_picking(osv.osv_memory): # Currently, the cost on the product form is supposed to be expressed in the currency # of the company owning the product. If not set, we fall back to the picking's company, # which should work in simple cases. + product_currency_id = move.product_id.company_id.currency_id and move.product_id.company_id.currency_id.id + picking_currency_id = move.picking_id.company_id.currency_id and move.picking_id.company_id.currency_id.id return {'cost': move.product_id.standard_price, - 'currency': move.product_id.company_id.currency_id.id \ - or move.picking_id.company_id.currency_id.id \ - or False} + 'currency': product_currency_id or picking_currency_id or False} def _partial_move_for(self, cr, uid, move): partial_move = { diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 1f102cafadf..646a71ae949 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -100,7 +100,7 @@ class stock_return_picking(osv.osv_memory): valid_lines = 0 return_history = self.get_return_history(cr, uid, record_id, context) for m in pick.move_lines: - if (return_history.get(m.id) == 0) and (m.product_qty * m.product_uom.factor > return_history[m.id]): + if (return_history.get(m.id) is not None) and (m.product_qty * m.product_uom.factor > return_history[m.id]): valid_lines += 1 if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!"))