[FIX] sale_timesheet: link timesheet line to product

Commit fde3a529 unlinks the product and the timesheet. Although we don't
want to use the cost of the product in the timesheet, we still want to
link the timesheet to the product for reporting.
This commit is contained in:
Nicolas Martinelli
2016-01-04 14:12:53 +01:00
parent 1b9baf1ac2
commit b2d92666d1
@@ -56,7 +56,10 @@ class AccountAnalyticLine(models.Model):
('product_id.type', '=', 'service')],
limit=1)
if sol:
result['so_line'] = sol.id
result.update({
'so_line': sol.id,
'product_id': sol.product_id.id,
})
result = self._get_timesheet_cost(result)
result = super(AccountAnalyticLine, self)._get_sale_order_line(vals=result)
@@ -75,7 +78,7 @@ class AccountAnalyticLine(models.Model):
uom = (emp or user).company_id.project_time_mode_id
# Nominal employee cost = 1 * company project UoM (project_time_mode_id)
result.update(
amount=(-unit_amount * emp.timesheet_cost),
amount=(-unit_amount * cost),
product_uom_id=uom.id
)
return result