diff --git a/hr_timesheet_sheet/__manifest__.py b/hr_timesheet_sheet/__manifest__.py index 5a3589b11..52e35f726 100644 --- a/hr_timesheet_sheet/__manifest__.py +++ b/hr_timesheet_sheet/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'HR Timesheet Sheet', - 'version': '12.0.1.1.0', + 'version': '12.0.1.1.1', 'category': 'Human Resources', 'sequence': 80, 'summary': 'Timesheet Sheets, Activities', diff --git a/hr_timesheet_sheet/models/hr_timesheet_sheet.py b/hr_timesheet_sheet/models/hr_timesheet_sheet.py index 8e5fb04fa..4269112bb 100644 --- a/hr_timesheet_sheet/models/hr_timesheet_sheet.py +++ b/hr_timesheet_sheet/models/hr_timesheet_sheet.py @@ -377,10 +377,10 @@ def unlink(self): return super().unlink() def _timesheet_subscribe_users(self): - for sheet in self: - if sheet.employee_id.parent_id.user_id: - self.message_subscribe_users( - user_ids=[sheet.employee_id.parent_id.user_id.id]) + for sheet in self.sudo(): + manager = sheet.employee_id.parent_id.user_id.partner_id + if manager: + self.message_subscribe(partner_ids=manager.ids) @api.multi def action_timesheet_draft(self): diff --git a/hr_timesheet_sheet/tests/test_hr_timesheet_sheet.py b/hr_timesheet_sheet/tests/test_hr_timesheet_sheet.py index 2a5128e77..78c6d953e 100644 --- a/hr_timesheet_sheet/tests/test_hr_timesheet_sheet.py +++ b/hr_timesheet_sheet/tests/test_hr_timesheet_sheet.py @@ -62,9 +62,16 @@ def setUp(self): 'company_ids': [(4, self.company_2.id)], }) + employee_manager = self.employee_model.create({ + 'name': "Test Manager", + 'user_id': self.user_2.id, + 'company_id': self.user.company_id.id, + }) + self.employee = self.employee_model.create({ 'name': "Test User", 'user_id': self.user.id, + 'parent_id': employee_manager.id, 'company_id': self.user.company_id.id, })