diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 200b61401..8138c458f 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -596,12 +596,12 @@ class SoongWorkflowCommentWizard(models.TransientModel): elif hasattr(biz_record, 'users_id') and biz_record.users_id: employee = biz_record.users_id.employee_ids action_id = self.env['ir.actions.act_window'].search([('res_model', '=', self.res_model)])[0] - url = f'https://oa.thtzjt.com/web?login={employee.user_id.login}&oauth_uid={employee.wecom_userid}#id={record_id.id}&cids=2&action={action_id.id}&model={record_id._name}&view_type=form&menu_id=10104' - self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', - user_id=employee.wecom_userid, - title=record_id._description, - description=f"编号为{record_id.code}的{record_id._description}已结束", - url=url, btntxt="查看详情") + # url = f'https://oa.thtzjt.com/web?login={employee.user_id.login}&oauth_uid={employee.wecom_userid}#id={record_id.id}&cids=2&action={action_id.id}&model={record_id._name}&view_type=form&menu_id=10104' + # self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', + # user_id=employee.wecom_userid, + # title=record_id._description, + # description=f"编号为{record_id.code}的{record_id._description}已结束", + # url=url, btntxt="查看详情") recipients = [] if self.node_btn_id.workflow_id.archive_type == 'applicant': diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index c40b09f6f..8bfc5f80e 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -626,7 +626,7 @@ class YuthonVacationReports(models.Model): def monthly_report(self): today = fields.Date.today() - employees = self.env['hr.employee'].search(['contract_id.state', '=', 'open']) + employees = self.env['hr.employee'].search([('contract_id.state', '=', 'open')]) current_month_first = today.replace(day=1) last_month_last = current_month_first - timedelta(days=1) last_month_first = last_month_last.replace(day=1) diff --git a/yuthon_hr_employee_approval/controllers/employee_login.py b/yuthon_hr_employee_approval/controllers/employee_login.py index 1efeb87a5..b2288dbf9 100644 --- a/yuthon_hr_employee_approval/controllers/employee_login.py +++ b/yuthon_hr_employee_approval/controllers/employee_login.py @@ -18,6 +18,13 @@ class EmployeeLogin(Controller): values['employee_id'] = int(employee_id) record = request.env['yuthon.message.login'].sudo().browse(values['employee_id']) values['staff_name'] = record.staff_name + if record.login_state == 'filled': + values['error'] = "该员工信息已提交,无法重复操作" + response = request.render('yuthon_hr_employee_approval.website_form_employee', values) + response.headers['X-Frame-Options'] = 'SAMEORIGIN' + response.headers['Content-Security-Policy'] = "frame-ancestors 'self'" + return response + if request.httprequest.method == 'POST': attachment = kw.get('attachment') if attachment: @@ -66,7 +73,8 @@ class EmployeeLogin(Controller): record.current_address = values.get("current_address", "") if "house_hold" in values and values.get("house_hold", ""): record.house_hold = values.get("house_hold", "") - values["message"] = "员工信息创建成功" + values["message"] = "员工信息更新成功" + record.login_state = 'filled' response = request.render('yuthon_hr_employee_approval.website_form_employee', values) response.headers['X-Frame-Options'] = 'SAMEORIGIN' response.headers['Content-Security-Policy'] = "frame-ancestors 'self'" diff --git a/yuthon_hr_employee_approval/models/yuthon_message_login.py b/yuthon_hr_employee_approval/models/yuthon_message_login.py index e16dfaa54..48875d0e7 100644 --- a/yuthon_hr_employee_approval/models/yuthon_message_login.py +++ b/yuthon_hr_employee_approval/models/yuthon_message_login.py @@ -21,7 +21,7 @@ nation_list = [('a', '汉族'), ('b', '壮族'), ('v', '满族'), ('d', '回族' class YuthonMessageLogin(models.Model): _name = 'yuthon.message.login' _description = "个人信息登记表" - _rec_name = 'name' + _rec_name = 'staff_name' _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin'] # 基本信息 @@ -95,6 +95,7 @@ class YuthonMessageLogin(models.Model): default='normal') active = fields.Boolean('Active', default=True, tracking=True) self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) + login_state = fields.Selection([('filled', '已填'), ('to_do', '未填')], string='状态', default='to_do') def _get_default_name_title(self): return self._description if self._description else self._name diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py index 7b30b54a6..713318b19 100644 --- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py @@ -25,7 +25,7 @@ class YuthonOnboardApproval(models.Model): name = fields.Char(string="标题") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_onboard_approval_code')) - employee_name_id = fields.Many2one('hr.applicant', string='姓名') + information_form_id = fields.Many2one('yuthon.message.login', string="姓名") users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) company_id = fields.Many2one(related='users_id.company_id', string="公司") department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") @@ -54,7 +54,6 @@ class YuthonOnboardApproval(models.Model): salary = fields.Float(string='基本工资') oter = fields.Text(string='其他约定') documents_ids = fields.Many2many('ir.attachment', string="附件") - information_form_id = fields.Many2one('yuthon.message.login', string="个人信息表详情", required=True) needs_form_id = fields.Many2one('yuthon.recruitment.approval', string="招聘需求详情") details_interview_form_id = fields.Many2one('hr.applicant', string="面试详情") is_issues = fields.Boolean(string='是否上会') @@ -77,7 +76,7 @@ class YuthonOnboardApproval(models.Model): salary_group_id = fields.Many2one( "yuthon.salary.group", string="工资单分组", store=True, index=True ) - + is_this_company = fields.Boolean(string='本公司', default=True) def _get_default_name_title(self): return self._description if self._description else self._name @@ -93,11 +92,11 @@ class YuthonOnboardApproval(models.Model): else: self.duration_employment_end = False - @api.onchange('employee_name_id', 'job_id', 'department_id1') + @api.onchange('information_form_id', 'job_id', 'department_id1') def _onchange_name(self): name_parts = [] - if self.employee_name_id: - name_parts.append(self.employee_name_id.partner_name) + if self.information_form_id: + name_parts.append(self.information_form_id.staff_name) if self.job_id: name_parts.append(self.job_id.name) if self.department_id1: @@ -136,14 +135,16 @@ class YuthonOnboardApproval(models.Model): } } - @api.onchange('employee_name_id') - def _onchange_employee_name_id(self): - if self.employee_name_id: - self.job_id = self.employee_name_id.job_id - self.department_id1 = self.employee_name_id.department_id - else: - self.job_id = False - self.department_id1 = False + @api.onchange('information_form_id') + def _onchange_information_form_id(self): + self.job_id = False + self.department_id1 = False + if self.information_form_id: + applicant_id = self.env['hr.applicant'].search([('partner_name', '=', self.information_form_id.staff_name)]) + if applicant_id: + self.job_id = applicant_id.job_id + self.department_id1 = applicant_id.department_id + @api.onchange('is_issues') def _onchange_is_issues(self): @@ -166,7 +167,7 @@ class YuthonOnboardApproval(models.Model): marital = 'single' else: marital = 'married' - employee_id = self.env['hr.employee'].create({'name': self.employee_name_id.partner_name, + employee_id = self.env['hr.employee'].create({'name': self.information_form_id.staff_name, 'birthday': login_id.date_birth, 'retire_date': self.duration_employment_end, 'political_aspects': login_id.political, diff --git a/yuthon_hr_employee_approval/views/yuthon_message_login_views.xml b/yuthon_hr_employee_approval/views/yuthon_message_login_views.xml index b5e98ae13..39ad6a0ff 100644 --- a/yuthon_hr_employee_approval/views/yuthon_message_login_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_message_login_views.xml @@ -9,6 +9,7 @@ + @@ -90,7 +91,8 @@ - + +
diff --git a/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml index df4107aeb..7a1118ad7 100644 --- a/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml @@ -27,7 +27,7 @@ invisible="urgency_level != 'urgent'"/> - + @@ -40,6 +40,9 @@ + + +

@@ -65,7 +68,7 @@ - +