From fd8e9da7e30b3dcbd2502e1c62c37dac019537f9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 21 Dec 2015 16:31:19 +0100 Subject: [PATCH] [FIX] hr_timesheet_sheet: link account line and sheet When an expense is recorded and linked to an analytic account, the associated line will appear in the timesheet. This fix links prevents linking an account analytic line to a timesheet sheet if the line is not a timesheet. Somehow related to a4b6e3a8 opw-657917 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 ++ addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 9a4b15945b7..92625f278f8 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -297,6 +297,8 @@ class account_analytic_line(osv.osv): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') res = {}.fromkeys(ids, False) for ts_line in self.browse(cursor, user, ids, context=context): + if not ts_line.is_timesheet: + continue sheet_ids = sheet_obj.search(cursor, user, [('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), ('employee_id.user_id', '=', ts_line.user_id.id), diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml index 774467e04a3..ffe000bacf1 100644 --- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -47,6 +47,7 @@ amount: -90.00 product_id: product.product_product_1 general_account_id: a_expense + is_timesheet: !eval True - I confirm my Timesheet at end of period by click on "Confirm" button, if the difference between Timesheet hour and attendance hour is more than 1 hour it will give message. @@ -75,6 +76,7 @@ amount: -90.00 product_id: product.product_product_1 general_account_id: a_expense + is_timesheet: !eval True - I set an allowed difference of 1 hour -