From ac294b25af866bb5a6f6caabd3ebf1797d77e228 Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Thu, 21 Jun 2018 14:11:33 +0200 Subject: [PATCH] [FIX] sale_timesheet: expense reinvoiced at cost in plan project When reinvoice an expensable product at cost, it should takes the amount on the analytic lines created when posting expenses, instead of the cost on the product. For instance, you create an expense with the generic expense product (for a lunch, for instance). The cost of the generic product is zero, but you don't want to see that amount in your project plan, and we don't want to create a product per "lunch expense". --- .../report/project_profitability_report_analysis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/sale_timesheet/report/project_profitability_report_analysis.py b/addons/sale_timesheet/report/project_profitability_report_analysis.py index 01ff1b1ceeb..ae450f9e2b8 100644 --- a/addons/sale_timesheet/report/project_profitability_report_analysis.py +++ b/addons/sale_timesheet/report/project_profitability_report_analysis.py @@ -60,7 +60,7 @@ class ProfitabilityAnalysis(models.Model): CASE WHEN T.expense_policy = 'sales_price' THEN (SOL.price_reduce / COALESCE(CR.rate, 1.0)) * SOL.qty_invoiced - ELSE IP.value_float * SOL.qty_invoiced + ELSE -COST_SUMMARY.expense_cost END ELSE 0.0 END AS expense_amount_untaxed_invoiced, @@ -145,7 +145,6 @@ class ProfitabilityAnalysis(models.Model): LEFT JOIN sale_order S ON SOL.order_id = S.id LEFT JOIN product_product PP on (SOL.product_id=PP.id) LEFT JOIN product_template T on (PP.product_tmpl_id=T.id) - LEFT JOIN ir_property IP ON (IP.name='standard_price' AND IP.res_id=CONCAT('product.product,',PP.id) AND IP.company_id=S.company_id) LEFT JOIN currency_rate CR ON (CR.currency_id = SOL.currency_id AND CR.currency_id != C.currency_id AND CR.company_id = SOL.company_id