From aec6248bb379c1ece02f5d4f718566c770fc2c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Wed, 23 Aug 2017 14:16:24 +0200 Subject: [PATCH] [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. --- addons/sale_timesheet/models/account.py | 4 ++-- 1 file 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: