diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 1cd38fd2f..2fc0e6591 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -25,6 +25,7 @@ 'views/inherit_planning_role_views.xml', 'views/inherit_planning_slot_views.xml', 'views/inherit_planning_slot_template_views.xml', + 'views/yuthon_customer_approval_views.xml', 'views/yuthon_shift_planning_views.xml', 'views/yuthon_run_planning_views.xml', 'views/overtime_approval.xml', diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 44709629a..eb3ce5ac9 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -14,3 +14,4 @@ from . import inherit_hr_employee from . import yuthon_shift_planning from . import yuthon_run_planning from . import duty_approval +from . import yuthon_customer_approval diff --git a/yuthon_hr_attendance/models/card_approval.py b/yuthon_hr_attendance/models/card_approval.py index 3f3be6ea4..e15a30430 100644 --- a/yuthon_hr_attendance/models/card_approval.py +++ b/yuthon_hr_attendance/models/card_approval.py @@ -65,22 +65,22 @@ class CardApprovals(models.Model): rec.attendance_id.check_out = rec.attendance_id.check_in.replace(hour=max_hour, minute=max_minute) - timedelta(hours=8) rec.attendance_id.is_approval = True - # @api.onchange('is_issues') - # def _onchange_is_issues(self): - # if self.is_issues: - # issue_id = self.env['issue.library'].create({'name': self.name}) - # self.related_issues_id = issue_id.id - # workflow_record_id = self.env["soong.workflow.record"].search( - # [("res_model", "=", self._name), ("res_id", "=", self.id)]) - # self.env['issue.library.approval.line'].create({ - # 'issue_library_id': issue_id.id, - # 'workflow_record_id': workflow_record_id.id, - # 'approval_type': workflow_record_id.workflow_id.id, - # 'code': self.code, - # 'approval_date': fields.Datetime.now(), - # }) - # elif self.related_issues_id: - # raise UserError("已经创建了相关的上会记录,不能取消勾选") + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 362e252e4..ec9bc051f 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -5,7 +5,6 @@ from datetime import timedelta from dateutil.relativedelta import relativedelta from odoo.tools import format_datetime, format_duration import logging -import re _logger = logging.getLogger(__name__) diff --git a/yuthon_hr_attendance/models/yuthon_customer_approval.py b/yuthon_hr_attendance/models/yuthon_customer_approval.py new file mode 100644 index 000000000..2aa1c6ab7 --- /dev/null +++ b/yuthon_hr_attendance/models/yuthon_customer_approval.py @@ -0,0 +1,39 @@ +from odoo import api, fields, models, tools, _ +from datetime import datetime, time, timedelta +from odoo.exceptions import UserError + + +class YuthonCustomerApproval(models.Model): + _name = 'yuthon.customer.approval' + _description = '客服值班审批' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] + _rec_name = 'name' + + yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司") + name = fields.Char(string="标题") + code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('overtime_approval')) + users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) + employee_id = fields.Many2one(related='users_id.employee_id', string="员工") + department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") + reason_application = fields.Html(string="申请事由") + documents_ids = fields.Many2many('ir.attachment', string="附件") + active = fields.Boolean('Active', default=True, tracking=True) + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") \ No newline at end of file diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index 19a0dac1f..38184069e 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -21,4 +21,5 @@ access_yuthon_high_run_line,high.run.line,model_yuthon_high_run_line,base.group_ access_yuthon_all_run_line,all.run.line,model_yuthon_all_run_line,base.group_user,1,1,1,1 access_yuthon_other_line,yuthon.other.line,model_yuthon_other_line,base.group_user,1,1,1,1 access_yuthon_shift_ever_white_line,shift.ever.white.line,model_yuthon_shift_ever_white_line,base.group_user,1,1,1,1 -access_yuthon_shift_ever_noon_line,shift.ever.noon.line,model_yuthon_shift_ever_noon_line,base.group_user,1,1,1,1 \ No newline at end of file +access_yuthon_shift_ever_noon_line,shift.ever.noon.line,model_yuthon_shift_ever_noon_line,base.group_user,1,1,1,1 +access_yuthon_customer_approval,yuthon.customer.approval,model_yuthon_customer_approval,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_hr_attendance/views/card_approval.xml b/yuthon_hr_attendance/views/card_approval.xml index 2cfd10b55..8e27bd9c8 100644 --- a/yuthon_hr_attendance/views/card_approval.xml +++ b/yuthon_hr_attendance/views/card_approval.xml @@ -13,7 +13,7 @@ - card.approval.actions + card.approval.form card.approval
diff --git a/yuthon_hr_attendance/views/yuthon_customer_approval_views.xml b/yuthon_hr_attendance/views/yuthon_customer_approval_views.xml new file mode 100644 index 000000000..36c0da8d4 --- /dev/null +++ b/yuthon_hr_attendance/views/yuthon_customer_approval_views.xml @@ -0,0 +1,50 @@ + + + + yuthon.customer.tree.views + yuthon.customer.approval + + + + + + + + + yuthon.customer.form.views + yuthon.customer.approval + + + +
+
+ + + + + + + + + + + + + + + + +
+ +
+
+ + 客服值班审批 + yuthon.customer.approval + tree,form + +
diff --git a/yuthon_salary/models/inherit_hr_payroll_structure_type.py b/yuthon_salary/models/inherit_hr_payroll_structure_type.py index b41c86c01..4ba9c99a6 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure_type.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure_type.py @@ -5,6 +5,6 @@ class HrPayrollStructureType(models.Model): _inherit = 'hr.payroll.structure.type' _description = '职级类别' - name = fields.Char(string='职级类行', required=True) + name = fields.Char(string='职级类型', required=True) yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='所属公司') \ No newline at end of file diff --git a/yuthon_work_brand/views/attendance_menu.xml b/yuthon_work_brand/views/attendance_menu.xml index 5e60f1f0e..2401a1329 100644 --- a/yuthon_work_brand/views/attendance_menu.xml +++ b/yuthon_work_brand/views/attendance_menu.xml @@ -274,6 +274,11 @@ parent="menu_hr_attendance_approval_request_board" sequence="13" action="yuthon_hr_attendance.approval_request_card"/> +