From 2a40f9a4997eecc6f997ab0e43dc6334263b9cad Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 13 Sep 2011 15:45:51 +0200 Subject: [PATCH] [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 --- addons/hr_expense/hr_expense.py | 2 +- addons/stock/stock.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 4ab71801a67..68d607b0335 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -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 diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 310b1067ff8..8d7e993d817 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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)