Skip to content

Commit

Permalink
[12.0][FIX] hr_timesheet_sheet: subscribe user when confirm (OCA#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe authored and RUS committed Nov 5, 2022
1 parent 50faeb0 commit 8706619
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hr_timesheet_sheet/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,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):
Expand Down
7 changes: 7 additions & 0 deletions hr_timesheet_sheet/tests/test_hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

Expand Down

0 comments on commit 8706619

Please sign in to comment.