Skip to content

Commit

Permalink
[FIX] l10n_be_hr_payroll: add missing group restrictions
Browse files Browse the repository at this point in the history
Without proper group restrictions many computed/related fields will
crash because they depend on other group-restricted fields, such as
the `children` field.
  • Loading branch information
odony committed Dec 13, 2017
1 parent a9d58a3 commit ae39802
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions addons/l10n_be_hr_payroll/models/l10n_be_hr_payroll.py
Expand Up @@ -215,23 +215,23 @@ class HrEmployee(models.Model):
spouse_fiscal_status = fields.Selection([
('without income', 'Without Income'),
('with income', 'With Income')
], string='Tax status for spouse')
disabled = fields.Boolean(string="Disabled", help="If the employee is declared disabled by law")
disabled_spouse_bool = fields.Boolean(string='Disabled Spouse', help='if recipient spouse is declared disabled by law')
disabled_children_bool = fields.Boolean(string='Disabled Children', help='if recipient children is/are declared disabled by law')
resident_bool = fields.Boolean(string='Nonresident', help='if recipient lives in a foreign country')
disabled_children_number = fields.Integer('Number of disabled children')
], string='Tax status for spouse', groups="hr.group_hr_user")
disabled = fields.Boolean(string="Disabled", help="If the employee is declared disabled by law", groups="hr.group_hr_user")
disabled_spouse_bool = fields.Boolean(string='Disabled Spouse', help='if recipient spouse is declared disabled by law', groups="hr.group_hr_user")
disabled_children_bool = fields.Boolean(string='Disabled Children', help='if recipient children is/are declared disabled by law', groups="hr.group_hr_user")
resident_bool = fields.Boolean(string='Nonresident', help='if recipient lives in a foreign country', groups="hr.group_hr_user")
disabled_children_number = fields.Integer('Number of disabled children', groups="hr.group_hr_user")
dependent_children = fields.Integer(compute='_compute_dependent_children', string='Considered number of dependent children', groups="hr.group_hr_user")
other_dependent_people = fields.Boolean(string="Other Dependent People", help="If other people are dependent on the employee")
other_senior_dependent = fields.Integer('# seniors (>=65)', help="Number of seniors dependent on the employee, including the disabled ones")
other_disabled_senior_dependent = fields.Integer('# disabled seniors (>=65)')
other_juniors_dependent = fields.Integer('# people (<65)', help="Number of juniors dependent on the employee, including the disabled ones")
other_disabled_juniors_dependent = fields.Integer('# disabled people (<65)')
dependent_seniors = fields.Integer(compute='_compute_dependent_people', string="Considered number of dependent seniors")
dependent_juniors = fields.Integer(compute='_compute_dependent_people', string="Considered number of dependent juniors")
spouse_net_revenue = fields.Float(string="Spouse Net Revenue", help="Own professional income, other than pensions, annuities or similar income")
other_dependent_people = fields.Boolean(string="Other Dependent People", help="If other people are dependent on the employee", groups="hr.group_hr_user")
other_senior_dependent = fields.Integer('# seniors (>=65)', help="Number of seniors dependent on the employee, including the disabled ones", groups="hr.group_hr_user")
other_disabled_senior_dependent = fields.Integer('# disabled seniors (>=65)', groups="hr.group_hr_user")
other_juniors_dependent = fields.Integer('# people (<65)', help="Number of juniors dependent on the employee, including the disabled ones", groups="hr.group_hr_user")
other_disabled_juniors_dependent = fields.Integer('# disabled people (<65)', groups="hr.group_hr_user")
dependent_seniors = fields.Integer(compute='_compute_dependent_people', string="Considered number of dependent seniors", groups="hr.group_hr_user")
dependent_juniors = fields.Integer(compute='_compute_dependent_people', string="Considered number of dependent juniors", groups="hr.group_hr_user")
spouse_net_revenue = fields.Float(string="Spouse Net Revenue", help="Own professional income, other than pensions, annuities or similar income", groups="hr.group_hr_user")
spouse_other_net_revenue = fields.Float(string="Spouse Other Net Revenue",
help='Own professional income which is exclusively composed of pensions, annuities or similar income')
help='Own professional income which is exclusively composed of pensions, annuities or similar income', groups="hr.group_hr_user")

@api.constrains('spouse_fiscal_status', 'spouse_net_revenue', 'spouse_other_net_revenue')
def _check_spouse_revenue(self):
Expand Down

0 comments on commit ae39802

Please sign in to comment.