Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][FIX] hr_timesheet_sheet: subscribe user when confirm #227

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hr_timesheet_sheet/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
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 @@ -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):
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