summaryrefslogtreecommitdiff
path: root/addons/analytic_user_function/analytic_user_function.py
diff options
context:
space:
mode:
authorJoel Grand-Guillaume <joel.grandguillaume@camptocamp.com>2009-12-23 18:14:09 +0100
committerJoel Grand-Guillaume <joel.grandguillaume@camptocamp.com>2009-12-23 18:14:09 +0100
commitb75d214b25cf7e7be63b4ad192b133d0456e9a14 (patch)
treeec342af94a63180d1b9ccffecb5f3011bdf81cf7 /addons/analytic_user_function/analytic_user_function.py
parent90ddcec2d73d2770455b1b6a2eac8cf3c023251c (diff)
[FIX] Analytic_user_function and project_timsheet corrected according to pricetype
bzr revid: joel.grandguillaume@camptocamp.com-20091223171409-a0wfgy034f8o5yjw
Diffstat (limited to 'addons/analytic_user_function/analytic_user_function.py')
-rw-r--r--addons/analytic_user_function/analytic_user_function.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py
index e2279bb891e..264c9fe43c0 100644
--- a/addons/analytic_user_function/analytic_user_function.py
+++ b/addons/analytic_user_function/analytic_user_function.py
@@ -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