[FIX] stock: check if currency on product or picking exists

bzr revid: nel@tinyerp.com-20120425072005-8dw7gqcmwp0jz3zb
This commit is contained in:
Najlaâ 2012-04-25 09:20:05 +02:00
parent d1ba5a6992
commit 5abb0e9b48
2 changed files with 4 additions and 4 deletions

View File

@ -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 = {

View File

@ -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)!"))