diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 43ffecd98..131fa301b 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- # email:pengyuthon@163.com - - { 'name': 'Yuthon attendances', 'summary': '', @@ -65,6 +63,9 @@ 'views/back_approval.xml', 'views/hr_attendance_portal_templates.xml', 'views/meal_approval.xml', + 'views/applet_address_views.xml', + 'views/all_attendance_menu.xml', + 'wizard/hr_attendance_month_wizard_views.xml', 'wizard/yuthon_delete_planning_wizard_views.xml', 'wizard/attendance_controls_wizard.xml', @@ -73,8 +74,7 @@ 'wizard/vacation_confirm_wizard_views.xml', 'wizard/planning_slot_update_display_name_wizard.xml', 'wizard/yuthon_run_wizard.xml', - 'views/applet_address_views.xml', - 'views/all_attendance_menu.xml', + 'wizard/applet_security_quick_perm_views.xml', ], 'assets': { 'web.assets_backend': [ diff --git a/yuthon_hr_attendance/controllers/applet_address.py b/yuthon_hr_attendance/controllers/applet_address.py index 1c69286f2..3ed20bff1 100644 --- a/yuthon_hr_attendance/controllers/applet_address.py +++ b/yuthon_hr_attendance/controllers/applet_address.py @@ -58,6 +58,20 @@ class AppletSecurity(models.Model): 'applet_security_setting_ids': [(4, clock_in_setting.id)], }) + def action_quick_add_permissions(self): + applet_ids = self.env["applet.security"].browse(self._context.get('active_ids', self._context.get('active_id'))) + return { + "type": "ir.actions.act_window", + "name": "快速添加权限", + "res_model": "applet.security.quick.perm.wizard", + "view_mode": "form", + "target": "new", + "context": { + "default_applet_security_ids": applet_ids.ids, # 默认员工 + # "default_employee_ids": applet_ids.employee_id.ids, # 默认员工 + }, + } + class AppletSecuritySeeting(models.Model): _name = 'applet.security.setting' diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index 065825cfd..e932198ee 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -79,4 +79,5 @@ access_staff_dining_report,staff.dining.report,model_staff_dining_report,base.gr access_vacation_confirm_wizard,vacation.confirm.wizard,model_vacation_confirm_wizard,base.group_user,1,1,1,1 access_vacation_put_wizard,vacation.put.wizard,model_vacation_put_wizard,base.group_user,1,1,1,1 -access_message_reminder_tasks,message.reminder.tasks,model_message_reminder_tasks,base.group_user,1,1,1,1 \ No newline at end of file +access_message_reminder_tasks,message.reminder.tasks,model_message_reminder_tasks,base.group_user,1,1,1,1 +access_applet_security_quick_perm_wizard,access_applet_security_quick_perm_wizard,model_applet_security_quick_perm_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_hr_attendance/views/applet_address_views.xml b/yuthon_hr_attendance/views/applet_address_views.xml index 954620b78..bb2a488ca 100644 --- a/yuthon_hr_attendance/views/applet_address_views.xml +++ b/yuthon_hr_attendance/views/applet_address_views.xml @@ -62,6 +62,15 @@ action = model.init_applet_security() + + 快速添加权限 + + + code + action = model.action_quick_add_permissions() + + + applet.security.setting.tree applet.security.setting diff --git a/yuthon_hr_attendance/wizard/__init__.py b/yuthon_hr_attendance/wizard/__init__.py index 60c5d4376..68b633658 100644 --- a/yuthon_hr_attendance/wizard/__init__.py +++ b/yuthon_hr_attendance/wizard/__init__.py @@ -7,4 +7,5 @@ from . import attendance_correct_wizard from . import yuthon_run_wizard from . import planning_slot_update_display_name_wizard from . import vacation_confirm_wizard -from . import vacation_put_wizard \ No newline at end of file +from . import vacation_put_wizard +from . import applet_security_quick_perm_wizard diff --git a/yuthon_hr_attendance/wizard/applet_security_quick_perm_views.xml b/yuthon_hr_attendance/wizard/applet_security_quick_perm_views.xml new file mode 100644 index 000000000..c70cb9b28 --- /dev/null +++ b/yuthon_hr_attendance/wizard/applet_security_quick_perm_views.xml @@ -0,0 +1,26 @@ + + + applet.security.quick.perm.wizard.form + applet.security.quick.perm.wizard + +
+ + + + +
+
+
+
+
+ + + 快速添加权限 + applet.security.quick.perm.wizard + form + + new + +
\ No newline at end of file diff --git a/yuthon_hr_attendance/wizard/applet_security_quick_perm_wizard.py b/yuthon_hr_attendance/wizard/applet_security_quick_perm_wizard.py new file mode 100644 index 000000000..a5baa4c29 --- /dev/null +++ b/yuthon_hr_attendance/wizard/applet_security_quick_perm_wizard.py @@ -0,0 +1,13 @@ +from odoo import models, fields + + +class AppletSecurityQuickPermWizard(models.TransientModel): + _name = 'applet.security.quick.perm.wizard' + _description = '快速添加权限' + + applet_security_ids = fields.Many2many('applet.security', string="权限记录集") + applet_security_setting_ids = fields.Many2many('applet.security.setting', string='权限板块') + + def confirm(self): + for applet in self.applet_security_ids: + applet.write({'applet_security_setting_ids': [(6, 0, self.applet_security_setting_ids.ids)]}) \ No newline at end of file