diff --git a/addons/sale_timesheet/models/project_overview.py b/addons/sale_timesheet/models/project_overview.py index 2ffed770810..804112f183e 100644 --- a/addons/sale_timesheet/models/project_overview.py +++ b/addons/sale_timesheet/models/project_overview.py @@ -115,6 +115,7 @@ class Project(models.Model): 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 - data.get('amount_untaxed_invoiced', 0.0) if other_revenues else 0.0 + profit['other_revenues'] = profit['other_revenues'] - data.get('expense_amount_untaxed_invoiced', 0.0) if profit['other_revenues'] else 0.0 profit['total'] = sum([profit[item] for item in profit.keys()]) dashboard_values['profit'] = profit diff --git a/addons/sale_timesheet/report/project_profitability_report_analysis.py b/addons/sale_timesheet/report/project_profitability_report_analysis.py index 4b91925f2b6..c98babbcf76 100644 --- a/addons/sale_timesheet/report/project_profitability_report_analysis.py +++ b/addons/sale_timesheet/report/project_profitability_report_analysis.py @@ -181,6 +181,14 @@ class ProfitabilityAnalysis(models.Model): LEFT JOIN account_analytic_account AA ON P.analytic_account_id = AA.id LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id WHERE AAL.amount > 0.0 AND AAL.project_id IS NULL AND P.active = 't' AND P.allow_timesheets = 't' + AND NOT EXISTS ( + SELECT SOL.id + FROM sale_order_line SOL + JOIN sale_order_line_invoice_rel SOINV ON SOINV.order_line_id = SOL.id + JOIN account_move_line AML ON SOINV.invoice_line_id = AAL.move_id + WHERE SOL.qty_delivered_method IN ('timesheet', 'manual') + OR (SOL.qty_delivered_method = 'analytic' AND SOL.invoice_status != 'no') + ) UNION ALL