From 1b086a94f3f7c64ede27e0c2f40ce432324a4f9d Mon Sep 17 00:00:00 2001 From: zhouzhou <123@qq.com> Date: Sun, 20 Oct 2024 21:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/models/yuthon_holiday_type.py | 1 - yuthon_holiday/views/yuthon_holiday_type.xml | 2 +- .../models/holidays_approval.py | 24 +++- .../views/holidays_approval.xml | 12 +- yuthon_issue/models/inherit_room_booking.py | 22 +--- yuthon_issue/models/issue_approval.py | 117 +++++------------- yuthon_issue/models/issue_library.py | 71 +++++++---- yuthon_issue/security/ir.model.access.csv | 2 +- yuthon_issue/static/xml/issue_approval.xml | 47 ------- .../issue_approval_decision_type_views.xml | 2 +- yuthon_issue/views/issue_approval_views.xml | 49 ++------ yuthon_issue/views/issue_library_views.xml | 14 ++- .../models/yuthon_Index_management.py | 4 +- .../models/yuthon_assessment_tasks.py | 19 +++ .../models/yuthon_duty_management.py | 2 +- .../models/yuthon_employee_appraisal.py | 2 +- .../models/yuthon_employee_performance.py | 14 ++- .../models/yuthon_grading_tasks.py | 8 +- .../models/yuthon_index_employee.py | 26 ++-- yuthon_performance/models/yuthon_kpi_tasks.py | 4 +- .../security/ir.model.access.csv | 3 +- .../views/yuthon_Index_approval.xml | 4 +- .../views/yuthon_Index_management.xml | 4 +- .../views/yuthon_assessment_tasks.xml | 6 +- .../views/yuthon_duty_approval.xml | 4 +- .../views/yuthon_employee_approval.xml | 5 +- .../views/yuthon_employee_performance.xml | 2 +- .../views/yuthon_grading_tasks.xml | 2 +- .../views/yuthon_index_employee.xml | 44 +++---- yuthon_performance/views/yuthon_kpi_tasks.xml | 2 +- .../yuthon_assessment_tasks_wizard_views.xml | 2 +- 31 files changed, 218 insertions(+), 302 deletions(-) diff --git a/yuthon_holiday/models/yuthon_holiday_type.py b/yuthon_holiday/models/yuthon_holiday_type.py index 811b24f42..025fb3f97 100644 --- a/yuthon_holiday/models/yuthon_holiday_type.py +++ b/yuthon_holiday/models/yuthon_holiday_type.py @@ -13,7 +13,6 @@ class HrLeaveType(models.Model): travel_leave = fields.Char(string='路程假') treated = fields.Text(string='待遇') remarks = fields.Text(string="备注") - # details_id = fields.Many2one('holiday.details.wizard', string='假期详情') diff --git a/yuthon_holiday/views/yuthon_holiday_type.xml b/yuthon_holiday/views/yuthon_holiday_type.xml index d16443f00..0ec7001a3 100644 --- a/yuthon_holiday/views/yuthon_holiday_type.xml +++ b/yuthon_holiday/views/yuthon_holiday_type.xml @@ -11,7 +11,7 @@ 假期类型 - + diff --git a/yuthon_hr_attendance/models/holidays_approval.py b/yuthon_hr_attendance/models/holidays_approval.py index 35696db3e..ceefd43bc 100644 --- a/yuthon_hr_attendance/models/holidays_approval.py +++ b/yuthon_hr_attendance/models/holidays_approval.py @@ -11,12 +11,11 @@ class HolidaysApprovals(models.Model): _description = "请假审批" # _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] - _rec_name = 'name' + name = fields.Char(string="名称") company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储')], string="公司") applicant_id = fields.Many2one('hr.employee', string="申请人", default=lambda self: self.env.user.id) leave_absence_id = fields.Many2one('hr.employee', string="请假人") - name = fields.Char(string="名称") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('holidays_approval')) department_id = fields.Many2one('hr.department', string="部门") approvals_ids = fields.One2many('holidays.approvals.line', 'approvals_id', string="请假审批行") @@ -33,6 +32,7 @@ class HolidaysApprovalsLine(models.Model): _name = 'holidays.approvals.line' _description = '请假审批行' + name = fields.Char(string="请假事由") approvals_id = fields.Many2one('holidays.approval', string="管理请假审批") vacation_category = fields.Many2one('holiday.type.setting', string="休假类别") leave_type_id = fields.Many2one('hr.leave.type', string="请假类型", @@ -42,8 +42,8 @@ class HolidaysApprovalsLine(models.Model): store=True) date_start = fields.Datetime(string="开始时间", default=fields.Datetime.now) date_end = fields.Datetime(string="结束时间") - leave_days = fields.Float(string='请假天数', store=True) - surplus_days = fields.Float(string="剩余天数") + leave_days = fields.Float(string='请假天数', store=True,compute='_compute_leave_days') + surplus_days = fields.Float(string="剩余天数",compute='_compute_surplus_days') @api.onchange('leave_type_id') def onchange_approvals_ids(self): @@ -51,6 +51,22 @@ class HolidaysApprovalsLine(models.Model): rec.days_available = rec.leave_type_id.holiday_days rec.applicants = rec.leave_type_id.request_unit + @api.depends('date_start', 'date_end') + def _compute_leave_days(self): + for rec in self: + if rec.date_start and rec.date_end: + delta = rec.date_end - rec.date_start + rec.leave_days = delta.days + (delta.seconds / 86400) + if rec.applicants == 'hour': + rec.leave_days = rec.leave_days / 24 + else: + rec.leave_days = 0 + + @api.depends('leave_days', 'days_available') + def _compute_surplus_days(self): + for rec in self: + rec.surplus_days = rec.days_available - rec.leave_days + def button_holiday_detail(self): return { 'name': '请假详情', diff --git a/yuthon_hr_attendance/views/holidays_approval.xml b/yuthon_hr_attendance/views/holidays_approval.xml index 36286b687..c3e62f4ad 100644 --- a/yuthon_hr_attendance/views/holidays_approval.xml +++ b/yuthon_hr_attendance/views/holidays_approval.xml @@ -6,7 +6,6 @@ holidays.approval - @@ -23,12 +22,6 @@ -
-
@@ -51,10 +44,11 @@ - - + + +