[FIX] *: browse_record getattr() now propagates context

When a different context needs to be passed to the
method call, it must now be an explicit keyword.
By default it can be ommitted in most cases.

bzr revid: odo@openerp.com-20110913134551-nmr80dgeolotplub
This commit is contained in:
Olivier Dony 2011-09-13 15:45:51 +02:00
parent 196c11d41e
commit 2a40f9a499
2 changed files with 6 additions and 6 deletions

View File

@ -276,7 +276,7 @@ class hr_expense_line(osv.osv):
if product_id:
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
res['name'] = product.name
amount_unit = product.price_get('standard_price', context=context)[product.id]
amount_unit = product.price_get('standard_price')[product.id]
res['unit_amount'] = amount_unit
if not uom_id:
res['uom_id'] = product.uom_id.id

View File

@ -309,7 +309,7 @@ class stock_location(osv.osv):
# Compute based on pricetype
# Choose the right filed standard_price to read
amount_unit = product.price_get('standard_price', context)[product.id]
amount_unit = product.price_get('standard_price', context=context)[product.id]
price = qty[product_id] * amount_unit
total_price += price
@ -891,7 +891,7 @@ class stock_picking(osv.osv):
if type in ('in_invoice', 'in_refund'):
# Take the user company and pricetype
context['currency_id'] = move_line.company_id.currency_id.id
amount_unit = move_line.product_id.price_get('standard_price', context)[move_line.product_id.id]
amount_unit = move_line.product_id.price_get('standard_price', context=context)[move_line.product_id.id]
return amount_unit
else:
return move_line.product_id.list_price
@ -1205,7 +1205,7 @@ class stock_picking(osv.osv):
new_std_price = new_price
else:
# Get the standard price
amount_unit = product.price_get('standard_price', context)[product.id]
amount_unit = product.price_get('standard_price', context=context)[product.id]
new_std_price = ((amount_unit * product_avail[product.id])\
+ (new_price * qty))/(product_avail[product.id] + qty)
# Write the field according to price type field
@ -2057,7 +2057,7 @@ class stock_move(osv.osv):
if context is None:
context = {}
currency_ctx = dict(context, currency_id = move.company_id.currency_id.id)
amount_unit = move.product_id.price_get('standard_price', currency_ctx)[move.product_id.id]
amount_unit = move.product_id.price_get('standard_price', context=currency_ctx)[move.product_id.id]
reference_amount = amount_unit * qty or 1.0
return reference_amount, reference_currency_id
@ -2443,7 +2443,7 @@ class stock_move(osv.osv):
new_std_price = new_price
else:
# Get the standard price
amount_unit = product.price_get('standard_price', context)[product.id]
amount_unit = product.price_get('standard_price', context=context)[product.id]
new_std_price = ((amount_unit * product.qty_available)\
+ (new_price * qty))/(product.qty_available + qty)