From 980afe683d365d938e9c3f7cc55eefdc2df873a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 4 Nov 2024 09:08:55 +0800 Subject: [PATCH] pengyuthon --- yuthon_holiday/__manifest__.py | 1 + yuthon_holiday/models/__init__.py | 1 + yuthon_holiday/models/inherit_hr_leave.py | 31 +-- .../models/inherit_hr_leave_accrual_plan.py | 8 + yuthon_holiday/views/hr_leave_batch.xml | 243 +++++++++--------- .../inherit_hr_leave_accrual_plan_views.xml | 13 + .../models/property_rental_form.py | 11 +- yuthon_work_brand/views/hr_menus.xml | 2 +- 8 files changed, 165 insertions(+), 145 deletions(-) create mode 100644 yuthon_holiday/models/inherit_hr_leave_accrual_plan.py create mode 100644 yuthon_holiday/views/inherit_hr_leave_accrual_plan_views.xml diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py index 0c03d7cad..c6599c339 100644 --- a/yuthon_holiday/__manifest__.py +++ b/yuthon_holiday/__manifest__.py @@ -9,6 +9,7 @@ 'security/ir.model.access.csv', 'views/inherit_hr_type_views.xml', 'views/inherit_hr_leave_allocation_views.xml', + 'views/inherit_hr_leave_accrual_plan_views.xml', 'views/hr_leave_batch.xml', ], 'demo': [], diff --git a/yuthon_holiday/models/__init__.py b/yuthon_holiday/models/__init__.py index c779f383e..31e67f00d 100644 --- a/yuthon_holiday/models/__init__.py +++ b/yuthon_holiday/models/__init__.py @@ -1,4 +1,5 @@ from . import inherit_hr_leave_allocation from . import inherit_hr_leave_type from . import inherit_hr_leave +from . import inherit_hr_leave_accrual_plan diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 5989d4ff6..09d80331c 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -4,9 +4,9 @@ from odoo.exceptions import ValidationError class HrLeave(models.Model): - _inherit = 'hr.leave' + _inherit = 'hr.leave' - batch_id = fields.Many2one(string='批量', comodel_name='hr.leave.batch', required=True, ondelete='cascade') + batch_id = fields.Many2one(string='批量', comodel_name='hr.leave.batch', required=True, ondelete='cascade') class HolidaysRequestBatch(models.Model): @@ -21,18 +21,14 @@ class HolidaysRequestBatch(models.Model): return emp name = fields.Char(string='标题') - employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp, index=True) + employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp, + index=True) leave_ids = fields.One2many(string='详情', comodel_name='hr.leave', inverse_name='batch_id') - state = fields.Selection(string='状态', selection=[ - ('draft', '撤回'), - ('confirm', '转交'), - ('refuse', '拒绝'), - ('validate', '审批') - ], default='draft', tracking=True, copy=False) - company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储')], string="公司") - users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) - leave_id = fields.Many2one('res.users', string="请假人") - department_id = fields.Many2one('hr.department', string="部门") + state = fields.Selection(string='状态', selection=[('draft', '撤回'), ('confirm', '转交'), + ('refuse', '拒绝'), ('validate', '审批') + ], default='draft', tracking=True, copy=False) + leave_id = fields.Many2one('res.users', string="请假人", default=lambda self: self.env.user.id) + department_id = fields.Many2one(related='leave_id.employee_id.department_id', string="部门") days = fields.Float(string='天数') hours = fields.Float(string='小时') text = fields.Html(string='申请事由') @@ -65,14 +61,15 @@ class HolidaysRequestBatch(models.Model): self.state = 'draft' self.leave_ids.action_draft() + class HrLeaveLine(models.Model): _name = 'hr.leave.line' leave_batch_id = fields.Many2one('hr.leave.batch', string="关联请假审批") - leave_type_id = fields.Many2one('hr.leave.type',string="请假类型") - available_days = fields.Integer(related='leave_type_id.available_days',string="可用天数") - applicants = fields.Selection(related='leave_type_id.request_unit',string="申请单位") - leave_documents_ids = fields.Many2many(related='leave_type_id.leave_documents_id',string="假期详情说明") + leave_type_id = fields.Many2one('hr.leave.type', string="请假类型") + available_days = fields.Integer(related='leave_type_id.available_days', string="可用天数") + applicants = fields.Selection(related='leave_type_id.request_unit', string="申请单位") + leave_documents_ids = fields.Many2many(related='leave_type_id.leave_documents_id', string="假期详情说明") start_time = fields.Date(string="开始时间") end_time = fields.Date(string="结束时间") days = fields.Float(string="天数") diff --git a/yuthon_holiday/models/inherit_hr_leave_accrual_plan.py b/yuthon_holiday/models/inherit_hr_leave_accrual_plan.py new file mode 100644 index 000000000..54be28581 --- /dev/null +++ b/yuthon_holiday/models/inherit_hr_leave_accrual_plan.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields, api + + +class HrLeaveAccrualPlan(models.Model): + _inherit = 'hr.leave.accrual.plan' + + documents_id = fields.Many2many('ir.attachment', string="假期详细说明") diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index dadabf6b7..5a87ff96e 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -1,8 +1,8 @@ - - - + + + hr.leave.batch.tree hr.leave.batch @@ -10,150 +10,149 @@ - - - - - + + + + -