Skip to content

Commit

Permalink
[FIX] hr_expense/holidays: approval issue if manager in different com…
Browse files Browse the repository at this point in the history
…pany

- When trying to retrieve the manager of an employee who is in a
different company, an access right error appears.
  This commit fixes this issue.
  • Loading branch information
tbe-odoo committed Aug 22, 2018
1 parent e1d4b48 commit 7f775f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/hr_expense/models/hr_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,6 @@ def activity_update(self):
for expense_report in self.filtered(lambda hol: hol.state == 'submit'):
self.activity_schedule(
'hr_expense.mail_act_expense_approval', fields.Date.today(),
user_id=expense_report._get_responsible_for_approval().id)
user_id=expense_report.sudo()._get_responsible_for_approval().id)
self.filtered(lambda hol: hol.state == 'approve').activity_feedback(['hr_expense.mail_act_expense_approval'])
self.filtered(lambda hol: hol.state == 'cancel').activity_unlink(['hr_expense.mail_act_expense_approval'])
4 changes: 2 additions & 2 deletions addons/hr_holidays/models/hr_leave_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ def activity_update(self):
elif allocation.state == 'confirm':
allocation.activity_schedule(
'hr_holidays.mail_act_leave_allocation_approval', fields.Date.today(),
user_id=allocation._get_responsible_for_approval().id)
user_id=allocation.sudo()._get_responsible_for_approval().id)
elif allocation.state == 'validate1':
allocation.activity_feedback(['hr_holidays.mail_act_leave_allocation_approval'])
allocation.activity_schedule(
'hr_holidays.mail_act_leave_allocation_second_approval', fields.Date.today(),
user_id=allocation._get_responsible_for_approval().id)
user_id=allocation.sudo()._get_responsible_for_approval().id)
elif allocation.state == 'validate':
to_do |= allocation
elif allocation.state == 'refuse':
Expand Down

0 comments on commit 7f775f0

Please sign in to comment.