[IMP] analytic_user_function: Improved on_change_user_id method
bzr revid: pso@tinyerp.com-20110425130341-tkjmjmeg9e76sxyg
This commit is contained in:
parent
aba97f892a
commit
ec5cbcc785
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue