diff options
| author | Anh Thao Pham (pta) <pta@odoo.com> | 2021-02-15 15:14:05 +0000 |
|---|---|---|
| committer | Anh Thao Pham (pta) <pta@odoo.com> | 2021-02-15 15:14:05 +0000 |
| commit | 4d9305d122f79792db780bbd97ae6732bf06ff9f (patch) | |
| tree | dcbcb5a6962f1b1953d3e07e1cac3e888069067a | |
| parent | 7a7dc212af7279544cffba362bce7daa4fc00865 (diff) | |
[FIX] sale_timesheet: fix (re-)invoiced amount computed as other revenue
- Install sale_timesheet and hr_expense
- Create a Service Product with "Create a task in sales order's project" as Service Tracking (i.e. Service X)
- Create a Product with "Can be Expensed" and "At cost" as "Re-Invoice Expenses" (i.e. Expense X)
- Create a SO with Service X (i.e. Unit Price: 50.0) and confirm it
- Go to Expenses and create an Expense:
* Product: Expense Y
* Unit Price: 25.0
* Customer to Reinvoice: [select the created SO]
- Create Report, Approve and Post journal entries
- From SO, create an Invoice (Service Y + Expense Y) and confirm it
In Project Overview, the expense is computed in Other Revenues and
Re-invoiced costs. Therefore, the amount of the expense is added twice
in the Profitability total.
In Project > Reporting > Project Costs and Revenues, for Project linked
to SO, Untaxed Amount Invoiced and Untaxed Amount Re-Invoiced are also
computed in Other Revenues.
opw-2444237
closes odoo/odoo#66186
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
| -rw-r--r-- | addons/sale_timesheet/models/project_overview.py | 1 | ||||
| -rw-r--r-- | addons/sale_timesheet/report/project_profitability_report_analysis.py | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/addons/sale_timesheet/models/project_overview.py b/addons/sale_timesheet/models/project_overview.py index 8c255cb8107..27979afc262 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 4edf5ddf1f3..d99970356bd 100644 --- a/addons/sale_timesheet/report/project_profitability_report_analysis.py +++ b/addons/sale_timesheet/report/project_profitability_report_analysis.py @@ -178,6 +178,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 |
