summaryrefslogtreecommitdiff
path: root/addons/analytic_user_function/analytic_user_function.py
diff options
context:
space:
mode:
authorHarry (Open ERP) <hmo@tinyerp.com>2010-02-19 15:58:48 +0530
committerHarry (Open ERP) <hmo@tinyerp.com>2010-02-19 15:58:48 +0530
commit453e18b2fdec270500b39c9b0b2f0cc684ad7cfd (patch)
tree97e80fde80111014297422dcc5514fa17fab22b1 /addons/analytic_user_function/analytic_user_function.py
parentdaaf25bfaa28b6136dd79d9b3f1dd54a570beb73 (diff)
parentd327a9a0e3ab407c69aad902fa967c92c4cc4eeb (diff)
[MERGE]
bzr revid: hmo@tinyerp.com-20100219102848-x6au29iuxc3e0dm0
Diffstat (limited to 'addons/analytic_user_function/analytic_user_function.py')
-rw-r--r--addons/analytic_user_function/analytic_user_function.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py
index e2279bb891e..c5c2af729a0 100644
--- a/addons/analytic_user_function/analytic_user_function.py
+++ b/addons/analytic_user_function/analytic_user_function.py
@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -99,8 +99,11 @@ class hr_analytic_timesheet(osv.osv):
_('There is no expense account define ' \
'for this product: "%s" (id:%d)') % \
(r.product_id.name, r.product_id.id,))
- amount = unit_amount * self.pool.get('product.uom')._compute_price(cr, uid,
- r.product_id.uom_id.id, r.product_id.standard_price, False)
+ # Compute based on pricetype
+ amount_unit=self.on_change_unit_amount(cr, uid, ids,
+ r.product_id.id, unit_amount, 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
@@ -132,8 +135,11 @@ class hr_analytic_timesheet(osv.osv):
_('There is no expense account define ' \
'for this product: "%s" (id:%d)') % \
(r.product_id.name, r.product_id.id,))
- amount = unit_amount * r.product_id.uom_id._compute_price(cr, uid,
- r.product_id.uom_id.id, r.product_id.standard_price, False)
+ # Compute based on pricetype
+ amount_unit=self.on_change_unit_amount(cr, uid, ids,
+ r.product_id.id, unit_amount, 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