Skip to content

Commit

Permalink
TA#58266 [14.0][FIX] hr_employee_declaration: access rights (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda authored Jan 28, 2025
1 parent 9fa5c52 commit 48af007
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hr_employee_declaration/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
'name': 'Employee Declarations',
'version': '14.0.1.0.0',
'version': '14.0.1.1.0',
'author': 'Numigi',
'maintainer': 'Numigi',
'website': 'https://bit.ly/numigi-com',
Expand Down
14 changes: 10 additions & 4 deletions hr_employee_declaration/models/employee_with_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ class HrEmployeeWithDeclarations(models.Model):
_inherit = 'hr.employee'

declaration_ids = fields.One2many(
'survey.user_input', string='Declarations',
compute='_compute_declaration_ids')

declaration_count = fields.Integer(compute='_compute_declaration_count')
"survey.user_input",
string="Declarations",
compute="_compute_declaration_ids",
groups="hr.group_hr_manager",
)

declaration_count = fields.Integer(
compute="_compute_declaration_count",
groups="hr.group_hr_manager",
)

def _compute_declaration_ids(self):
for employee in self:
Expand Down
18 changes: 15 additions & 3 deletions hr_employee_declaration/models/send_declaration_survey_by_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ class HrEmployeeWithSendDeclarations(models.Model):
_inherit = 'hr.employee'

declaration_survey_id = fields.Many2one(
'survey.survey', 'Declaration Survey', ondelete='restrict')
"survey.survey",
"Declaration Survey",
ondelete="restrict",
groups="hr.group_hr_manager",
)
declaration_recipient_id = fields.Many2one(
'hr.employee', 'Declaration Recipient', ondelete='restrict')
"hr.employee",
"Declaration Recipient",
ondelete="restrict",
groups="hr.group_hr_manager",
)
declaration_mail_template_id = fields.Many2one(
'mail.template', 'Declaration Email Template', ondelete='restrict')
"mail.template",
"Declaration Email Template",
ondelete="restrict",
groups="hr.group_hr_manager",
)

def send_declaration_survey_by_email(self):
"""Send the declaration by email to a single employee.
Expand Down
20 changes: 14 additions & 6 deletions hr_employee_declaration/models/send_declaration_survey_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ class HrEmployeeWithDeclarationEmailCron(models.Model):

_inherit = 'hr.employee'

periodic_declaration = fields.Boolean()
declaration_next_date = fields.Date('Next Declaration Date')
declaration_periodicity = fields.Selection([
('month', 'Month'),
('year', 'Year'),
])
periodic_declaration = fields.Boolean(
groups="hr.group_hr_manager",
)
declaration_next_date = fields.Date(
"Next Declaration Date",
groups="hr.group_hr_manager",
)
declaration_periodicity = fields.Selection(
[
("month", "Month"),
("year", "Year"),
],
groups="hr.group_hr_manager",
)

def send_due_declaration_surveys_by_email(self):
"""Send every due employee declarations by email."""
Expand Down

0 comments on commit 48af007

Please sign in to comment.