diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index a724672a6..dcd7bb310 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -21,6 +21,7 @@ 'views/inherit_hr_employee_views.xml', 'views/hr_attendance_views.xml', 'views/resource_calendar_leaves_views.xml', + 'views/attendance_iot_datas.xml', 'views/attendance_iot_manager_views.xml', 'views/overtime_approval.xml', 'views/go_approval.xml', diff --git a/yuthon_hr_attendance/controllers/kaoqin_test.py b/yuthon_hr_attendance/controllers/kaoqin_test.py index c29565705..378c71c5d 100644 --- a/yuthon_hr_attendance/controllers/kaoqin_test.py +++ b/yuthon_hr_attendance/controllers/kaoqin_test.py @@ -76,3 +76,23 @@ class BusController(Controller): }) print("---------------------------------------------测试成功---------------------------------------") return {"Result": 0, "Msg": "添加成功"} + + @route('/api/v1/record/face', methods=['POST'], type='json', auth='none', csrf=False) + def get_model_identify(self): + """ + 获取上传识别成功记录 + :return: + """ + data = request.httprequest.json + user_name = data.get('logs').get('user_id') + employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('user_id', '=', user_name.id)]) + attendance_iot = request.env(user=SUPERUSER_ID)["attendance.iot.datas"] + if not attendance_iot.search( + [('employee_id', '=', employee_id.id), ('attendance_number', '=', data.get('sn'))]): + attendance_iot.create({ + 'attendance_number': data.get('sn'), + 'attendance_date': data.get('logs').get('recog_time'), + 'employee_id': employee_id.id, + }) + print("---------------------------------------------测试成功---------------------------------------") + return {"Result": 0, "Msg": "添加成功"} diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index e9ce5c2c2..5996422af 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -13,4 +13,5 @@ from . import card_approval from . import holiday_manage from . import holiday_manage_balance from . import attendance_iot_manager +from . import attendance_iot_datas diff --git a/yuthon_hr_attendance/models/attendance_iot_datas.py b/yuthon_hr_attendance/models/attendance_iot_datas.py new file mode 100644 index 000000000..275af7010 --- /dev/null +++ b/yuthon_hr_attendance/models/attendance_iot_datas.py @@ -0,0 +1,12 @@ +from odoo import api, fields, models, tools +from odoo.exceptions import ValidationError + + +class AttendanceIotDatas(models.Model): + _name = 'attendance.iot.datas' + _description = '上传识别记录' + + + employee_id = fields.Many2one('hr.employee', string='人员') + attendance_date = fields.Datetime(string='打卡时间') + attendance_number = fields.Char(string="设备号") diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index ab5318c89..6502aa02d 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -11,5 +11,6 @@ access_card_approval,card.approval,model_card_approval,base.group_user,1,1,1,1 access_holiday_manage,holiday_manage,model_holiday_manage,base.group_user,1,1,1,1 access_attendance_iot_manager,attendance_iot_manager,model_attendance_iot_manager,base.group_user,1,1,1,1 access_holiday_manage_balance,holiday_manage_balance,model_holiday_manage_balance,base.group_user,1,1,1,1 +access_attendance_iot_datas,attendance_iot_datas,model_attendance_iot_datas,base.group_user,1,1,1,1 diff --git a/yuthon_hr_attendance/views/all_attendance_menu.xml b/yuthon_hr_attendance/views/all_attendance_menu.xml index 6dbf110a0..d24a6154d 100644 --- a/yuthon_hr_attendance/views/all_attendance_menu.xml +++ b/yuthon_hr_attendance/views/all_attendance_menu.xml @@ -30,4 +30,6 @@ sequence="15" action="attendance_iot_manager_action"/> - \ No newline at end of file + + diff --git a/yuthon_hr_attendance/views/attendance_iot_datas.xml b/yuthon_hr_attendance/views/attendance_iot_datas.xml new file mode 100644 index 000000000..fb2b7074e --- /dev/null +++ b/yuthon_hr_attendance/views/attendance_iot_datas.xml @@ -0,0 +1,19 @@ + + + + attendance.iot.datas.tree + attendance.iot.datas + + + + + + + + + + 上传记录 + attendance.iot.datas + tree,form + + \ No newline at end of file diff --git a/yuthon_hr_employee/models/yuthon_hr_department.py b/yuthon_hr_employee/models/yuthon_hr_department.py index 2a08054fe..1d3890d19 100644 --- a/yuthon_hr_employee/models/yuthon_hr_department.py +++ b/yuthon_hr_employee/models/yuthon_hr_department.py @@ -18,11 +18,21 @@ class YuthonHrDepartment(models.Model): expiration_date = fields.Date(string="失效日期", default=fields.Date.today()) end_date = fields.Date(string="结束时间") department_code = fields.Char(string="部门序号", store=True) + lower_ids = fields.One2many('hr.department', 'parent_id', string="下级部门") @api.onchange('department_code', 'parent_id') def _onchange_department_code(self): for code in self: if code.parent_id.department_code: - code.department_code = code.parent_id.department_code + code.department_code if code.department_code else '' + code.department_code = code.parent_id.department_code + ('.' + code.department_code.split('.')[-1] if code.department_code else '') else: - code.department_code = code.department_code \ No newline at end of file + code.department_code = code.department_code + code.update_code() + def update_code(self): + def cycle_code(parent,parent_code): + for child in parent.lower_ids: + new_code = parent_code +('.' + child.department_code.split('.')[-1] if child.department_code else '') + self.env['hr.department'].search([('id', '=', child.id.origin)]).write({'department_code': new_code}) + cycle_code(child,new_code) + + cycle_code(self, self.department_code) \ No newline at end of file diff --git a/yuthon_hr_employee/views/inherit_hr_applicant_views.xml b/yuthon_hr_employee/views/inherit_hr_applicant_views.xml index 817b34290..d90d45fec 100644 --- a/yuthon_hr_employee/views/inherit_hr_applicant_views.xml +++ b/yuthon_hr_employee/views/inherit_hr_applicant_views.xml @@ -10,6 +10,7 @@

+

diff --git a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py index b4e379f10..04f8506c9 100644 --- a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py +++ b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py @@ -9,6 +9,7 @@ class HrApplicant(models.Model): room_id = fields.Many2one('room.room',string='地点') interview_results = fields.Selection([('pass', '通过'), ('fail', '不通过')], string="面试结果") + def buttn_applicant_ids(self): self.ensure_one() return { @@ -19,32 +20,41 @@ class HrApplicant(models.Model): 'target': 'current', } + def pub_interview_approval(self): for applicant in self: if not applicant.is_interview_status: applicant.is_interview_status = True - else: - raise UserError('已提交面试申请') + raise UserError(_('该申请已提交,请勿重复提交!')) hr_applicant_ids = self.env["hr.applicant"].browse(self._context.get('active_ids', self._context.get('active_id'))) hr_applicant_data = [(6, 0, hr_applicant_ids.ids)] stage_list = [stage.name for stage in self.env['hr.recruitment.stage'].search([])] # 便利出所有的阶段 + for sta in self: stage_self = stage_list.index(sta.stage_id.name) if stage_self == 0: sta.stage_id = self.env['hr.recruitment.stage'].search([('name', '=', stage_list[stage_self + 1])]).id - form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id - return { - 'type': 'ir.actions.act_window', - 'name': '提交面试申请', - 'res_model': 'yuthon.interview.approval', - "views": [[form_id, "form"]], - "context": { - 'default_name': '面试申请表', - 'default_job_id': self.job_id.id, - 'default_department_id': self.department_id.id, - 'default_applicant_ids': hr_applicant_data + form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id + return { + 'type': 'ir.actions.act_window', + 'name': '提交面试申请', + 'res_model': 'yuthon.interview.approval', + "views": [[form_id, "form"]], + "context": { + 'default_name': '面试申请表', + 'default_job_id': self.job_id.id, + 'default_department_id': self.department_id.id, + 'default_applicant_ids': hr_applicant_data + } } - } + + def write(self, vals): + # 调用父类的 write 方法更新记录 + res = super(HrApplicant, self).write(vals) + # 检查是否修改了 'stage_id' 字段 + if 'stage_id' in vals: + self.is_interview_status = False + return res diff --git a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py index ae896768c..bf027c76b 100644 --- a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py @@ -18,26 +18,19 @@ class YuthonInterviewApproval(models.Model): applicant_ids = fields.One2many('hr.applicant', 'interview_approval_id', string='应聘面试信息') - def test_submissions(self): - # 得到标签顺序列表,用来判断下一个阶段 - stage_list = [stage.name for stage in self.env['hr.recruitment.stage'].search([])] - for applicant in self.applicant_ids: - failed_stage = self.env['hr.recruitment.stage'].search([('name', '=', '未通过')], limit=1) - if applicant.interview_results == 'pass': - current_stage_index = stage_list.index(applicant.stage_id.name) - next_stage_index = current_stage_index + 1 - # 检查是否已经是最后一个阶段 - if next_stage_index < len(stage_list): - next_stage_name = stage_list[next_stage_index] - next_stage = self.env['hr.recruitment.stage'].search([('name', '=', next_stage_name)], limit=1) - applicant.stage_id = next_stage - else: - # 已经是最后一个阶段,可以进行其他操作,例如发送通知等 - raise UserError('已经是最后一个阶段') - elif applicant.interview_results == 'fail': - applicant.stage_id = failed_stage - - - + + def scheduling_of_meetings(self): + form_id = self.env.ref("room.room_booking_view_form").id + self.ensure_one() + return { + 'type': 'ir.actions.act_window', + 'name': '会议安排', + 'res_model': 'room.booking', + "views": [[form_id, "form"]], + "context": { + 'default_name': self.name, + 'default_employee_ids': [(6, 0, self.employee_ids.ids)] + } + } diff --git a/yuthon_hr_employee_approval/models/yuthon_leaving_approval.py b/yuthon_hr_employee_approval/models/yuthon_leaving_approval.py index a4fed6b27..2532e5a68 100644 --- a/yuthon_hr_employee_approval/models/yuthon_leaving_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_leaving_approval.py @@ -29,6 +29,8 @@ class YuthonLeavingApproval(models.Model): is_leaving = fields.Boolean(string="同意离职", default=False) leaving_date = fields.Date(string="工作期限") handover_person = fields.Many2one("hr.employee", string="交接人") + + class HrJobType(models.Model): _name = "hr.job.type" diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py index 1df0bb399..695ecaca8 100644 --- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py @@ -33,6 +33,7 @@ class YuthonOnboardApproval(models.Model): probation_period = fields.Selection([('zero', '0个月'), ('one', '1个月'), ('two', '2个月'), ('three', '3个月'), ('year', '1年')], string='试用期结束时间') duration_employment = fields.Date(string='劳动合同期限') + duration_employment_end = fields.Date(string='劳动合同结束时间') salary = fields.Float(string='基本工资') oter = fields.Text(string='其他约定') social_security = fields.Char(string='社保时长') diff --git a/yuthon_hr_employee_approval/views/menuitem.xml b/yuthon_hr_employee_approval/views/menuitem.xml index d06a3aa20..99f7976ed 100644 --- a/yuthon_hr_employee_approval/views/menuitem.xml +++ b/yuthon_hr_employee_approval/views/menuitem.xml @@ -27,6 +27,11 @@ parent="hr_process_work_job" action="yuthon_message_login_action" sequence="7"/> + @@ -44,11 +49,6 @@ parent="hr_set_process_menu" action="yuthon_leaving_approval_action" sequence="3"/> -
- - - +
+

@@ -48,6 +48,7 @@ +

- + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - 物业管理审批 + 物业管理变更审批 property.management tree,form diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml index f9fb9f24b..1072a536a 100644 --- a/yuthon_property_approval/views/property_menu_all.xml +++ b/yuthon_property_approval/views/property_menu_all.xml @@ -1,5 +1,13 @@ + + + diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 7549dbb86..b47d4063e 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -93,6 +93,11 @@ parent="hr_process_work_job_menu_board" action="yuthon_hr_employee_approval.yuthon_message_login_action" sequence="9"/> + + + - + sequence="5"/> + sequence="7"/>