From 67480b3904b84c82cc6cbaf2b229ceaa3fb237a2 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 26 Mar 2010 16:57:31 +0530 Subject: [PATCH] [FIX] stock: fix small problmes bzr revid: hmo@tinyerp.com-20100326112731-3z57rtooizu7uhxt --- addons/product/product.py | 2 +- addons/stock/stock.py | 8 ++++---- addons/stock/wizard/stock_partial_picking.py | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 6ea0c73fe10..d51d0733e81 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -547,7 +547,7 @@ class product_product(osv.osv): pricetype_obj = self.pool.get('product.price.type') # Take the price_type currency from the product field # This is right cause a field cannot be in more than one currency - price_type_id = pricetype_obj.search(cr,ui,['field','=',ptype])[0] + price_type_id = pricetype_obj.search(cr, uid, [('field','=',ptype)])[0] price_type_currency_id = pricetype_obj.browse(cr,uid,price_type_id).currency_id.id res[product.id] = self.pool.get('res.currency').compute(cr, uid, price_type_currency_id, context['currency_id'], res[product.id],context=context) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 869b2503903..a801fe4fcd9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -894,7 +894,7 @@ class stock_picking(osv.osv): assert partial_data, _('Do not Found Partial data of Stock Move Line :%s' %(move.id)) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty - product_uom = partial_data.get('product_uom',False) + product_uom = partial_data.get('product_uom',False) product_price = partial_data.get('product_price',0.0) product_currency = partial_data.get('product_currency',False) if move.product_qty == product_qty: @@ -908,16 +908,16 @@ class stock_picking(osv.osv): if (pick.type == 'in') and (move.product_id.cost_method == 'average'): product = product_obj.browse(cr, uid, move.product_id.id) user = users_obj.browse(cr, uid, uid) - context['currency_id'] = move.company_id.currency_id.id + context['currency_id'] = move.company_id.currency_id.id qty = uom_obj._compute_qty(cr, uid, product_uom, product_qty, product.uom_id.id) pricetype = False if user.company_id.property_valuation_price_type: pricetype = price_type_obj.browse(cr, uid, user.company_id.property_valuation_price_type.id) if pricetype and qty > 0: - new_price = currency_obj.compute(cr, uid, currency, + new_price = currency_obj.compute(cr, uid, product_currency, user.company_id.currency_id.id, product_price) new_price = uom_obj._compute_price(cr, uid, product_uom, new_price, - product.uom_id.id) + product.uom_id.id) if product.qty_available <= 0: new_std_price = new_price else: diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index bc23d0371d0..494fb3b1231 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -103,9 +103,9 @@ class stock_partial_picking(osv.osv_memory): _moves_arch_lst += """ - - - + + + """%(m.id, m.id, m.id) if (pick.type == 'in') and (m.product_id.cost_method == 'average'): _moves_fields.update({ @@ -122,7 +122,7 @@ class stock_partial_picking(osv.osv_memory): }) _moves_arch_lst += """ - + """%(m.id, m.id) _moves_arch_lst += """ @@ -206,15 +206,15 @@ class stock_partial_picking(osv.osv_memory): if m.state in ('done', 'cancel'): continue partial_datas['move%s'%(m.id)] = { - 'product_id' : getattr(partial, 'move%s_product_id'%(m.id)), + 'product_id' : getattr(partial, 'move%s_product_id'%(m.id)).id, 'product_qty' : getattr(partial, 'move%s_product_qty'%(m.id)), - 'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)) + 'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id } if (pick.type == 'in') and (m.product_id.cost_method == 'average'): partial_datas['move%s'%(m.id)].update({ 'product_price' : getattr(partial, 'move%s_product_price'%(m.id)), - 'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)) + 'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id }) res = pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)