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 @@ 结束时间 + +