From b65ca4b9f8d4e9807dabc9d3a785a293cd01765c Mon Sep 17 00:00:00 2001
From: zhouzhou <123@qq.com>
Date: Tue, 26 Nov 2024 21:42:27 +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/__init__.py | 1 +
yuthon_holiday/__manifest__.py | 4 +-
yuthon_holiday/models/__init__.py | 1 +
.../models/inherit_hr_leave_allocation.py | 16 ++++++
.../models/inherit_hr_leave_type.py | 6 ++-
.../models/yuthon_fixes_approval.py | 22 ++++++++
yuthon_holiday/security/ir.model.access.csv | 4 +-
.../inherit_hr_leave_allocation_views.xml | 3 ++
.../views/inherit_hr_type_views.xml | 32 +++++++++++
.../views/yuthon_fixes_approval_views.xml | 53 +++++++++++++++++++
yuthon_holiday/wizard/__init__.py | 1 +
yuthon_holiday/wizard/yuthon_fixes_wizard.py | 28 ++++++++++
.../wizard/yuthon_fixes_wizard_views.xml | 26 +++++++++
yuthon_work_brand/views/hr_menus.xml | 40 +++++++++++---
14 files changed, 228 insertions(+), 9 deletions(-)
create mode 100644 yuthon_holiday/models/yuthon_fixes_approval.py
create mode 100644 yuthon_holiday/views/yuthon_fixes_approval_views.xml
create mode 100644 yuthon_holiday/wizard/__init__.py
create mode 100644 yuthon_holiday/wizard/yuthon_fixes_wizard.py
create mode 100644 yuthon_holiday/wizard/yuthon_fixes_wizard_views.xml
diff --git a/yuthon_holiday/__init__.py b/yuthon_holiday/__init__.py
index 0650744f6..9b4296142 100644
--- a/yuthon_holiday/__init__.py
+++ b/yuthon_holiday/__init__.py
@@ -1 +1,2 @@
from . import models
+from . import wizard
diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py
index 12b2c373d..e551595ae 100644
--- a/yuthon_holiday/__manifest__.py
+++ b/yuthon_holiday/__manifest__.py
@@ -12,10 +12,12 @@
'views/inherit_hr_leave_allocation_views.xml',
'views/inherit_hr_leave_accrual_plan_views.xml',
'views/hr_leave_accrual_views.xml',
+ 'views/yuthon_fixes_approval_views.xml',
'views/hr_leave_batch.xml',
+ 'wizard/yuthon_fixes_wizard_views.xml',
],
'demo': [],
- 'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee'],
+ 'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee', 'base', 'yuthon_issue', 'documents'],
'installable': True,
'application': True,
}
diff --git a/yuthon_holiday/models/__init__.py b/yuthon_holiday/models/__init__.py
index 04894078d..fbf329563 100644
--- a/yuthon_holiday/models/__init__.py
+++ b/yuthon_holiday/models/__init__.py
@@ -2,3 +2,4 @@ from . import inherit_hr_leave_allocation
from . import inherit_hr_leave_type
from . import inherit_hr_leave
from . import inherit_hr_leave_accrual_plan
+from . import yuthon_fixes_approval
diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py
index 1a7d53e91..62ee42d66 100644
--- a/yuthon_holiday/models/inherit_hr_leave_allocation.py
+++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py
@@ -84,3 +84,19 @@ class HrLeaveAllocation(models.Model):
if allocation_vals:
self.env['hr.leave.allocation'].with_context(mail_notify_force_send=False, mail_activity_automation_skip=True).create(allocation_vals)
self.linked_request_ids.filtered(lambda c: c.state != 'validate').action_validate()
+
+ def button_fixes_wizard(self):
+ return {
+ "type": "ir.actions.act_window",
+ "name": "修正申请",
+ "res_model": "yuthon.fixes.wizard",
+ "view_mode": 'form',
+ 'target': 'new',
+ "context": {
+ 'default_users_id': self.employee_id.user_id.id,
+ 'default_duration_display': self.duration_display,
+ }
+ }
+
+
+
diff --git a/yuthon_holiday/models/inherit_hr_leave_type.py b/yuthon_holiday/models/inherit_hr_leave_type.py
index c1a55b020..736039200 100644
--- a/yuthon_holiday/models/inherit_hr_leave_type.py
+++ b/yuthon_holiday/models/inherit_hr_leave_type.py
@@ -10,4 +10,8 @@ class HrLeaveType(models.Model):
request_unit = fields.Selection([('day', '天'), ('hour', '小时'), ('half_day', '半天')], string="请假单位", default='hour')
employee_requests = fields.Selection([('yes', '允许的额外天数要求'), ('no', '不允许')], string='员工要求', default='yes')
allocation_validation_type = fields.Selection(defalt='no')
- yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
\ No newline at end of file
+ yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
+ start_date = fields.Date(string="生效日期", default=fields.Date.today())
+ expiration_date = fields.Date(string="失效日期")
+ is_enable = fields.Boolean(string="启用", default=True)
+ employee_ids = fields.Many2many('hr.employee', string='人员范围')
\ No newline at end of file
diff --git a/yuthon_holiday/models/yuthon_fixes_approval.py b/yuthon_holiday/models/yuthon_fixes_approval.py
new file mode 100644
index 000000000..9439b14d8
--- /dev/null
+++ b/yuthon_holiday/models/yuthon_fixes_approval.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from odoo import models, fields, api
+
+
+class YuthonFixesApproval(models.Model):
+ _name = 'yuthon.fixes.approval'
+ _description = '假期修正审批'
+ _inherit = 'soong.workflow.mixin'
+
+ yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
+ name = fields.Char(string="标题")
+ code = fields.Char(string="编号")
+ users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
+ original_days = fields.Char(string="原休假天数")
+ now_days = fields.Char(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)
+
diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv
index 74e00e239..f5205425e 100644
--- a/yuthon_holiday/security/ir.model.access.csv
+++ b/yuthon_holiday/security/ir.model.access.csv
@@ -1,4 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_leave_batch,hr_leave_batch,model_hr_leave_batch,base.group_user,1,1,1,1
access_hr_leave_line,hr_leave_line,model_hr_leave_line,base.group_user,1,1,1
-access_hr_leave_type,hr_leave_type,model_hr_leave_type,base.group_user,1,1,1,1
\ No newline at end of file
+access_hr_leave_type,hr_leave_type,model_hr_leave_type,base.group_user,1,1,1,1
+access_yuthon_fixes_approval,yuthon_fixes_approval,model_yuthon_fixes_approval,base.group_user,1,1,1,1
+access_yuthon_fixes_wizard,yuthon_fixes_wizard,model_yuthon_fixes_wizard,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml
index 3ecaa04fa..a11a693e7 100644
--- a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml
+++ b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml
@@ -17,6 +17,9 @@
结束时间
+
+
+
diff --git a/yuthon_holiday/views/inherit_hr_type_views.xml b/yuthon_holiday/views/inherit_hr_type_views.xml
index 455887a3e..0d846aafc 100644
--- a/yuthon_holiday/views/inherit_hr_type_views.xml
+++ b/yuthon_holiday/views/inherit_hr_type_views.xml
@@ -11,6 +11,11 @@
1
+
+
+
+
+
@@ -23,6 +28,9 @@
+
+
+
@@ -44,4 +52,28 @@
+
+ 全部
+ hr.leave.type
+ tree,form
+
+
+ 天河投资
+ hr.leave.type
+ tree,form
+ [('yuthon_company','=','thtz')]
+
+
+ 天河粮储
+ hr.leave.type
+ tree,form
+ [('yuthon_company', '=', 'thlc')]
+
+
+ 天河物管
+ hr.leave.type
+ tree,form
+ [('yuthon_company', '=', 'thwg')]
+
+
\ No newline at end of file
diff --git a/yuthon_holiday/views/yuthon_fixes_approval_views.xml b/yuthon_holiday/views/yuthon_fixes_approval_views.xml
new file mode 100644
index 000000000..82f551c3d
--- /dev/null
+++ b/yuthon_holiday/views/yuthon_fixes_approval_views.xml
@@ -0,0 +1,53 @@
+
+
+
+ yuthon.fixes.approval.tree
+ yuthon.fixes.approval
+
+
+
+
+
+
+
+
+
+
+ yuthon.fixes.approval.form
+ yuthon.fixes.approval
+
+
+
+
+
+ 假期修正审批
+ yuthon.fixes.approval
+ tree,form
+
+
diff --git a/yuthon_holiday/wizard/__init__.py b/yuthon_holiday/wizard/__init__.py
new file mode 100644
index 000000000..89d88b744
--- /dev/null
+++ b/yuthon_holiday/wizard/__init__.py
@@ -0,0 +1 @@
+from . import yuthon_fixes_wizard
\ No newline at end of file
diff --git a/yuthon_holiday/wizard/yuthon_fixes_wizard.py b/yuthon_holiday/wizard/yuthon_fixes_wizard.py
new file mode 100644
index 000000000..52a9b9cdd
--- /dev/null
+++ b/yuthon_holiday/wizard/yuthon_fixes_wizard.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*
+from odoo import models, fields, api
+
+
+class YuthonFixesWizard(models.TransientModel):
+ _name = 'yuthon.fixes.wizard'
+ _description = '修正按钮弹窗'
+
+ remediate_days = fields.Char(string='修正天数')
+ users_id = fields.Many2one('res.users')
+ duration_display = fields.Char(string='假期余额')
+
+ def confirm(self):
+ form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
+ return {
+ "type": "ir.actions.act_window",
+ "name": "修正申请",
+ "res_model": "yuthon.fixes.approval",
+ "views": [[form_id, "form"]],
+ "context": {
+ 'default_users_id': self.users_id.id,
+ 'default_now_days': self.remediate_days,
+ 'default_original_days': self.duration_display
+ }
+ }
+
+
+
diff --git a/yuthon_holiday/wizard/yuthon_fixes_wizard_views.xml b/yuthon_holiday/wizard/yuthon_fixes_wizard_views.xml
new file mode 100644
index 000000000..b67524d0c
--- /dev/null
+++ b/yuthon_holiday/wizard/yuthon_fixes_wizard_views.xml
@@ -0,0 +1,26 @@
+
+
+
+ yuthon.fixes.wizard.form
+ yuthon.fixes.wizard
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index f9836f945..800179a4b 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -257,15 +257,24 @@
parent="holiday_manage_menu_root_board"
action="hr_holidays.action_hr_holidays_dashboard"
sequence="3"/>
-
+
+
+
+
+
+
+