diff options
| author | pso (OpenERP) <pso@tinyerp.com> | 2011-04-25 17:40:48 +0530 |
|---|---|---|
| committer | pso (OpenERP) <pso@tinyerp.com> | 2011-04-25 17:40:48 +0530 |
| commit | aba97f892a5e3a699c3074b402445af5d68724c3 (patch) | |
| tree | f07db8b6f7ca9fe63c0d2b62152e84887d6906a1 /addons/analytic_user_function | |
| parent | 2f1607c786edb621164ab26a9c904ef1585a37fb (diff) | |
[FIX] analytic_user_function: Fixed KeyError ('amount')
lp bug: https://launchpad.net/bugs/768968 fixed
bzr revid: pso@tinyerp.com-20110425121048-rbur3dny3ou88tpf
Diffstat (limited to 'addons/analytic_user_function')
| -rw-r--r-- | addons/analytic_user_function/analytic_user_function.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 04f66fb8daa..79f3a17fdbc 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -66,7 +66,7 @@ class hr_analytic_timesheet(osv.osv): return False - def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): + def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0.0): res = {} if not (account_id): #avoid a useless call to super @@ -98,11 +98,11 @@ class hr_analytic_timesheet(osv.osv): 'for this product: "%s" (id:%d)') % \ (r.product_id.name, r.product_id.id,)) # Compute based on pricetype - amount_unit = self.on_change_unit_amount(cr, uid, ids, - r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] - - amount = unit_amount * amount_unit - res ['value']['amount']= - round(amount, 2) + if unit_amount: + amount_unit = self.on_change_unit_amount(cr, uid, ids, + r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] + amount = unit_amount * amount_unit + res ['value']['amount']= - round(amount, 2) res ['value']['general_account_id']= a return res |
