diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py index 7206a80ac..f0b463a4e 100644 --- a/yuthon_holiday/models/yuthon_vacation_reports.py +++ b/yuthon_holiday/models/yuthon_vacation_reports.py @@ -10,11 +10,14 @@ class YuthonVacationReports(models.Model): _rec_name = "employee_id" employee_id = fields.Many2one('hr.employee', string='员工') + department_id = fields.Many2one(related='employee_id.department_id', string="部门") company_id = fields.Many2one(related="employee_id.company_id", string="公司") leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细') overtime_ids = fields.One2many('vacation.over.line', 'vacation_id', string='加班明细') meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细') medical_fee_ids = fields.One2many('vacation.medical.line', 'vacation_id', string='体检费明细') + other_fee_ids = fields.One2many('vacation.other.line', 'vacation_id', string='其他明细') + vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today()) leave = fields.Char(string='年假', compute='_compute_leave', store=True) working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True) @@ -35,22 +38,6 @@ class YuthonVacationReports(models.Model): record.medical_fee = max(total, 0.0) - def action_open_my_form(self): - employee = self.env.user.employee_id - vacation_report = self.env['yuthon.vacation.reports'].search( - [('employee_id', '=', employee.id)], limit=1) - return { - 'name': '我的假期额度', - 'type': 'ir.actions.act_window', - 'res_model': 'yuthon.vacation.reports', - 'view_mode': 'form', - 'res_id': vacation_report.id, - 'view_id': self.env.ref('yuthon_holiday.view_yuthon_vacation_reports_form1').id, - 'context': { - 'default_employee_id': employee.id, - }, - } - def overtime_allocation(self): form_id = self.env.ref('hr_holidays.hr_leave_allocation_view_form_manager').id holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '补休')]) @@ -426,7 +413,19 @@ class VacationMedicalLine(models.Model): return record +class VacationOtherLine(models.Model): + _name = 'vacation.other.line' + _description = '其他' + vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录') + holiday_type = fields.Many2one('hr.leave.type', string="假期类型") + employee_id = fields.Many2one('hr.employee', string='员工') + workflow_record_id = fields.Many2one('soong.workflow.record', string='流程') + update_date = fields.Date(string='更新时间') + update_type = fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型') + is_void = fields.Boolean(string='是否作废', default=False) + lines = fields.Float(string='天数') + text = fields.Text(string='备注') class DetailsTree(models.Model): _name = 'details.tree' diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv index 2b531e9b0..583d690e2 100644 --- a/yuthon_holiday/security/ir.model.access.csv +++ b/yuthon_holiday/security/ir.model.access.csv @@ -12,3 +12,4 @@ access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1 access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1 access_vacation_medical_line,vacation_medical_line,model_vacation_medical_line,base.group_user,1,1,1,1 +access_vacation_other_line,vacation_other_line,model_vacation_other_line,base.group_user,1,1,1,1 diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml index dbcf09ab4..a0ae22cda 100644 --- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml +++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml @@ -15,6 +15,21 @@ + + yuthon.vacation.my.reports.tree + yuthon.vacation.reports + + + + + + + + + + + + yuthon.vacation.reports.form yuthon.vacation.reports @@ -110,6 +125,22 @@ + + + + + + + + + + + + +