From 3ef3d3a8c10678f331bcb00a5b852b41afe4de47 Mon Sep 17 00:00:00 2001 From: "Victor Piryns (pivi)" Date: Thu, 13 Jul 2023 12:09:01 +0000 Subject: [PATCH] [FIX] sale_timesheet: don't count expense as record hours on SO Issue: Expenses linked to an SO are counted as 1 hour of timesheet linked to the SO. Steps to reproduce: - Install Sales, Timesheets, Expense - Create an SO and sell a service that creates a Task > Confirm - Log some timesheet on the task (3h for ex.) - Create an expense related to the SO, approve it and generate the journal entries. - On the SO, the smart button shows 4h clocked, and when you click on it, the expense line is showed, which shouldn't be the case. Cause: Incorrect domain taking the `order_line` without filtering on the fact that they may be expenses or not. Fix: Specify the domain on the action to exclude expense lines. Affected versions: - 14.0 - count is correct, only action is showing more lines - 15.0 - same as described in the commit msg - saas-15.2 - 16.0 - saas-16.1 - saas-16.2 - saas-16.3 - master opw-3302460 closes odoo/odoo#128764 X-original-commit: 7ee275a4a454898989d15f42941f4a1bb7a48db9 Signed-off-by: Xavier Bol (xbo) Signed-off-by: Piryns Victor (pivi) --- addons/sale_timesheet/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/sale_order.py b/addons/sale_timesheet/models/sale_order.py index bc88ca8167f..6aee4d9e679 100644 --- a/addons/sale_timesheet/models/sale_order.py +++ b/addons/sale_timesheet/models/sale_order.py @@ -126,7 +126,7 @@ class SaleOrder(models.Model): context['default_project_id'] = self.project_ids[0].id action.update({ 'context': context, - 'domain': [('so_line', 'in', self.order_line.ids)], + 'domain': [('so_line', 'in', self.order_line.ids), ('project_id', '!=', False)], 'help': _("""

No activities found. Let's start a new one!