[IMP]: Added Upstream Patch for hr_payroll

This commit is contained in:
Harsh Vadodaria 2018-07-06 15:23:58 +05:30
parent ac96a360fd
commit 87ec60d4df

View File

@ -85,6 +85,11 @@ class HrSalaryRuleCategory(models.Model):
company_id = fields.Many2one('res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get())
@api.constrains('parent_id')
def _check_parent_id(self):
if not self._check_recursion():
raise ValidationError(_('Error! You cannot create recursive hierarchy of Salary Rule Category.'))
class HrSalaryRule(models.Model):
_name = 'hr.salary.rule'
@ -165,6 +170,11 @@ class HrSalaryRule(models.Model):
input_ids = fields.One2many('hr.rule.input', 'input_id', string='Inputs', copy=True)
note = fields.Text(string='Description')
@api.constrains('parent_rule_id')
def _check_parent_rule_id(self):
if not self._check_recursion(parent='parent_rule_id'):
raise ValidationError(_('Error! You cannot create recursive hierarchy of Salary Rules.'))
@api.multi
def _recursive_search_of_rules(self):
"""