[FIX] hr: allow onboarding plan access for officers

taskID 2969653

closes odoo/odoo#99407

Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Dossogne Bertrand
2022-09-15 19:20:49 +02:00
parent f0e3c5146d
commit 3f3d4370e8
5 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ access_hr_plan_activity_type_employee,access_hr_plan_activity_type,model_hr_plan
access_hr_plan_employee,access_hr_plan_employee,model_hr_plan,base.group_user,1,0,0,0
access_hr_plan_activity_type_hr_user,access_hr_plan_activity_type,model_hr_plan_activity_type,group_hr_user,1,1,1,1
access_hr_plan_hr_user,access_hr_plan_hr_user,model_hr_plan,group_hr_user,1,1,1,1
access_hr_plan_wizard,access.hr.plan.wizard,model_hr_plan_wizard,hr.group_hr_manager,1,1,1,0
access_hr_plan_wizard,access.hr.plan.wizard,model_hr_plan_wizard,hr.group_hr_user,1,1,1,0
access_hr_departure_wizard,access.hr.departure.wizard,model_hr_departure_wizard,hr.group_hr_user,1,1,1,0
access_hr_work_location_user,access_hr_work_location_user,model_hr_work_location,base.group_user,1,0,0,0
access_hr_work_location_manager,access_hr_work_location_manager,model_hr_work_location,group_hr_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
12 access_hr_plan_employee access_hr_plan_employee model_hr_plan base.group_user 1 0 0 0
13 access_hr_plan_activity_type_hr_user access_hr_plan_activity_type model_hr_plan_activity_type group_hr_user 1 1 1 1
14 access_hr_plan_hr_user access_hr_plan_hr_user model_hr_plan group_hr_user 1 1 1 1
15 access_hr_plan_wizard access.hr.plan.wizard model_hr_plan_wizard hr.group_hr_manager hr.group_hr_user 1 1 1 0
16 access_hr_departure_wizard access.hr.departure.wizard model_hr_departure_wizard hr.group_hr_user 1 1 1 0
17 access_hr_work_location_user access_hr_work_location_user model_hr_work_location base.group_user 1 0 0 0
18 access_hr_work_location_manager access_hr_work_location_manager model_hr_work_location group_hr_manager 1 1 1 1
+1 -1
View File
@@ -52,7 +52,7 @@
<field name="image_128" invisible="1" />
<field name="company_id" invisible="1"/>
<header>
<button name="%(plan_wizard_action)d" string="Launch Plan" type="action" groups="hr.group_hr_manager"/>
<button name="%(plan_wizard_action)d" string="Launch Plan" type="action" groups="hr.group_hr_user"/>
</header>
<sheet>
<div name="button_box" class="oe_button_box">
+2 -2
View File
@@ -122,7 +122,7 @@
id="menu_config_plan"
name="Activity Planning"
parent="menu_human_resources_configuration"
groups="group_hr_manager"
groups="group_hr_user"
sequence="100"/>
<menuitem
@@ -130,7 +130,7 @@
name="On/Offboarding Plans"
action="hr_plan_action"
parent="menu_config_plan"
groups="group_hr_manager"
groups="group_hr_user"
sequence="100"/>
</data>
+6 -1
View File
@@ -12,7 +12,12 @@ class HrPlanWizard(models.TransientModel):
def _default_plan_id(self):
# We know that all employees belong to the same company
employee = self.env['hr.employee'].browse(self.env.context.get('active_ids')[0] if self.env.context.get('active_ids') else [])
return self.env['hr.plan'].search([('company_id', '=', employee.company_id.id)], limit=1)
return self.env['hr.plan'].search([
('company_id', '=', employee.company_id.id),
'|',
('department_id', '=', employee.department_id.id),
('department_id', '=', False)
], limit=1)
plan_id = fields.Many2one('hr.plan', default=lambda self: self._default_plan_id(),
domain="[('company_id', '=', company_id), '|', ('department_id', '=', department_id), ('department_id', '=', False)]")
+2 -2
View File
@@ -18,8 +18,8 @@
</div>
</sheet>
<footer>
<button name="action_launch" string="Launch Plan" type="object" class="oe_highlight" attrs="{'invisible': [('warning', '!=', False)]}" groups="hr.group_hr_manager" data-hotkey="q"/>
<button name="action_launch" string="Launch Plan" type="object" class="oe_highlight" disabled="disabled" attrs="{'invisible': [('warning', '=', False)]}" groups="hr.group_hr_manager" data-hotkey="q"/>
<button name="action_launch" string="Launch Plan" type="object" class="oe_highlight" attrs="{'invisible': [('warning', '!=', False)]}" groups="hr.group_hr_user" data-hotkey="q"/>
<button name="action_launch" string="Launch Plan" type="object" class="oe_highlight" disabled="disabled" attrs="{'invisible': [('warning', '=', False)]}" groups="hr.group_hr_user" data-hotkey="q"/>
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="z"/>
</footer>
</form>