summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2017-08-23 14:16:24 +0200
committerJérome Maes <jem@openerp.com>2017-08-23 15:21:38 +0200
commitaec6248bb379c1ece02f5d4f718566c770fc2c6f (patch)
treeeee52c230906edde526a2c246cb7362d66456a6c
parenta8bb544628f7dda5bc68ff4e07b9c6adb6467907 (diff)
[FIX] sale_timesheet: apply correct discount in revenue computation
The discount is saved as a percentage, not in a decimal value between 0 and 1.
-rw-r--r--addons/sale_timesheet/models/account.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py
index a2880645372..eec7637be31 100644
--- a/addons/sale_timesheet/models/account.py
+++ b/addons/sale_timesheet/models/account.py
@@ -120,12 +120,12 @@ class AccountAnalyticLine(models.Model):
sale_price = so_line.currency_id.compute(sale_price_hour, analytic_account.currency_id) # amount from SO should be convert into analytic account currency
# calculate the revenue on the timesheet
if so_line.product_id.invoice_policy == 'delivery':
- revenue = analytic_account.currency_id.round(unit_amount * sale_price * (1-so_line.discount))
+ revenue = analytic_account.currency_id.round(unit_amount * sale_price * (1-(so_line.discount/100)))
billable_type = 'billable_time'
elif so_line.product_id.invoice_policy == 'order' and so_line.product_id.track_service == 'task':
quantity_hour = so_line.product_uom._compute_quantity(so_line.product_uom_qty, timesheet_uom)
# compute the total revenue the SO since we are in fixed price
- total_revenue_so = analytic_account.currency_id.round(quantity_hour * sale_price * (1-so_line.discount))
+ total_revenue_so = analytic_account.currency_id.round(quantity_hour * sale_price * (1-(so_line.discount/100)))
# compute the total revenue already existing (without the current timesheet line)
domain = [('so_line', '=', so_line.id)]
if self.ids: