[FIX] stock: fix small problmes
authorHarry (Open ERP) <hmo@tinyerp.com>
Fri, 26 Mar 2010 11:27:31 +0000 (16:57 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Fri, 26 Mar 2010 11:27:31 +0000 (16:57 +0530)
bzr revid: hmo@tinyerp.com-20100326112731-3z57rtooizu7uhxt

addons/product/product.py
addons/stock/stock.py
addons/stock/wizard/stock_partial_picking.py

index 6ea0c73..d51d073 100644 (file)
@@ -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)
index 869b250..a801fe4 100644 (file)
@@ -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:
index bc23d03..494fb3b 100644 (file)
@@ -103,9 +103,9 @@ class stock_partial_picking(osv.osv_memory):
                     
                     _moves_arch_lst += """
                         <group colspan="4" col="10">
-                        <field name="move%s_product_id" />
-                        <field name="move%s_product_qty" />
-                        <field name="move%s_product_uom" />
+                        <field name="move%s_product_id" nolabel="1"/>
+                        <field name="move%s_product_qty" string="Qty" />
+                        <field name="move%s_product_uom" nolabel="1" />
                     """%(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 += """
                             <field name="move%s_product_price" />
-                            <field name="move%s_product_currency" />
+                            <field name="move%s_product_currency" nolabel="1"/>
                         """%(m.id, m.id)
                     _moves_arch_lst += """
                         </group>
@@ -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)