diff --git a/attendance_iot/models/attendance_iot_user.py b/attendance_iot/models/attendance_iot_user.py index 2fa8dfe93..9dd8e2a28 100644 --- a/attendance_iot/models/attendance_iot_user.py +++ b/attendance_iot/models/attendance_iot_user.py @@ -11,3 +11,4 @@ class AttendanceIotUser(models.Model): department_id = fields.Many2one(related='employee_id.department_id', string="部门") company_id = fields.Many2one(related='employee_id.company_id', string="公司", store=True) id_valid = fields.Date(string="有效日期") + image_1920 = fields.Image("一寸照") diff --git a/attendance_iot/views/attendance_iot_user_views.xml b/attendance_iot/views/attendance_iot_user_views.xml index ede44b96e..6ca4447f2 100644 --- a/attendance_iot/views/attendance_iot_user_views.xml +++ b/attendance_iot/views/attendance_iot_user_views.xml @@ -6,6 +6,7 @@ + diff --git a/yuthon_hr_attendance/controllers/applet_address.py b/yuthon_hr_attendance/controllers/applet_address.py index ffea8601b..026811770 100644 --- a/yuthon_hr_attendance/controllers/applet_address.py +++ b/yuthon_hr_attendance/controllers/applet_address.py @@ -15,6 +15,15 @@ class AppletAddress(models.Model): latitude = fields.Float(string="纬度", digits=(16, 6)) card_rice = fields.Integer(string="打卡范围(米)") + def update_employee(self): + applet_ids = self.env["applet.address"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for record in applet_ids: + matching_employees = self.env['hr.employee'].search([ + ('company_id.name', '=', record.address_name) + ]) + record.employee_ids = [(6, 0, matching_employees.ids)] + class AppletSecurity(models.Model): _name = 'applet.security' diff --git a/yuthon_hr_attendance/views/applet_address_views.xml b/yuthon_hr_attendance/views/applet_address_views.xml index 295334909..a5c2dcbf5 100644 --- a/yuthon_hr_attendance/views/applet_address_views.xml +++ b/yuthon_hr_attendance/views/applet_address_views.xml @@ -7,7 +7,7 @@ - + @@ -20,4 +20,11 @@ applet.address tree + + 更新员工 + + + code + action = model.update_employee() + \ No newline at end of file diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 2847e405f..2c602f806 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -174,11 +174,11 @@ parent="hr_attendance_root_board_menu" sequence="18" action="yuthon_hr_attendance.applet_address_action"/> - + + + + +