[FIX] sale_timesheet: Non billable task in project Overview

Steps to reproduce the bug:

- Let's consider a product P with price=100€, Timesheets on tasks and Create a task in sales order's project
- Create a SO with 1 P and confirm it
- A project PR and a task T have been created
- Assign an employee E to T and record 01:00 hour
- Create an invoice I from the SO and confirm I
- Go to the project overview of the SO

Bug:

100€ was counted twice in Non billable task and in Billed on Timesheets

PS:

When validating I, an analytic line L is created and L is not linked to PR.
That's why 100€ was counted twice because L was counted once in the 'Invoiced' part
and once in the 'Other revenue'

opw:2370418

closes odoo/odoo#61880

X-original-commit: 46d254e79900cbb76521d8e6b00f7c7597a914c9
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-11-17 16:15:35 +00:00
parent 95d58c75e9
commit fa3a0dbac2
@@ -103,7 +103,7 @@ class Project(models.Model):
profit['cost'] += data.get('timesheet_cost', 0.0)
profit['expense_cost'] += data.get('expense_cost', 0.0)
profit['expense_amount_untaxed_invoiced'] += data.get('expense_amount_untaxed_invoiced', 0.0)
profit['other_revenues'] = other_revenues or 0
profit['other_revenues'] = other_revenues - data.get('amount_untaxed_invoiced', 0.0) if other_revenues else 0.0
profit['total'] = sum([profit[item] for item in profit.keys()])
dashboard_values['profit'] = profit