[FIX] stock: fix small problmes

bzr revid: hmo@tinyerp.com-20100326112731-3z57rtooizu7uhxt
This commit is contained in:
Harry (Open ERP) 2010-03-26 16:57:31 +05:30
parent 003c39ebef
commit 67480b3904
3 changed files with 12 additions and 12 deletions

View 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)

View 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:

View 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)