diff options
| author | pso (OpenERP) <pso@tinyerp.com> | 2011-04-25 18:33:41 +0530 |
|---|---|---|
| committer | pso (OpenERP) <pso@tinyerp.com> | 2011-04-25 18:33:41 +0530 |
| commit | ec5cbcc7857a172f302ca952650ed711254dbdb9 (patch) | |
| tree | 4cb4ef041c641f360613260730d96eb372e28953 /addons/analytic_user_function | |
| parent | aba97f892a5e3a699c3074b402445af5d68724c3 (diff) | |
[IMP] analytic_user_function: Improved on_change_user_id method
bzr revid: pso@tinyerp.com-20110425130341-tkjmjmeg9e76sxyg
Diffstat (limited to 'addons/analytic_user_function')
| -rw-r--r-- | addons/analytic_user_function/analytic_user_function.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 79f3a17fdbc..d9d260c6940 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -106,7 +106,7 @@ class hr_analytic_timesheet(osv.osv): res ['value']['general_account_id']= a return res - def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): + def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0.0): res = {} if not (user_id): #avoid a useless call to super @@ -133,11 +133,12 @@ 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'] + 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) + amount = unit_amount * amount_unit + res ['value']['amount']= - round(amount, 2) res ['value']['general_account_id']= a return res |
