Skip to content

Commit

Permalink
[FIX] compute function can be called with multiple records
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yelizariev committed Oct 13, 2016
1 parent dd8afae commit a75cdc8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions hr_holidays_legal_leave/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def _inverse_remaining_days(self):

@api.multi
def _compute_remaining_days(self):
self.ensure_one()
legal_leave = self.company_id.legal_holidays_status_id
if not legal_leave:
raise UserError(_('Legal/annual leave type is not defined for '
'your company.'))
self.remaining_leaves = legal_leave.get_days(
self.id)[legal_leave.id]['remaining_leaves']
for r in self:
legal_leave = r.company_id.legal_holidays_status_id
if not legal_leave:
raise UserError(_('Legal/annual leave type is not defined for '
'your company.'))
r.remaining_leaves = legal_leave.get_days(
r.id)[legal_leave.id]['remaining_leaves']

remaining_leaves = fields.Integer(
'Remaining Legal Leaves',
Expand Down

0 comments on commit a75cdc8

Please sign in to comment.