[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".
This commit is contained in:
jem-odoo
2018-06-25 14:29:26 +02:00
parent 6c9176652f
commit ac294b25af
@@ -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