From 15069c8df30acd1ede7349d3933454ed898f2c51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Thu, 22 Jan 2026 10:36:38 +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
---
.../templates/soong_workflow_templates.xml | 4 +-
.../views/soong_workflow_record.xml | 49 ++++++++++++++++++-
.../models/overtime_approval.py | 5 +-
.../models/yuthon_vacation_reports.py | 32 +++++++++++-
.../static/src/js/button_vacation_put.js | 30 +++++++++---
.../views/yuthon_vacation_reports_views.xml | 40 +++++++++++++++
.../wizard/pay_carryover_wizard.py | 4 +-
.../security/yuthon_official_group.xml | 25 ----------
8 files changed, 148 insertions(+), 41 deletions(-)
diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml
index bb46f1887..6a176b10f 100644
--- a/soong_workflow/templates/soong_workflow_templates.xml
+++ b/soong_workflow/templates/soong_workflow_templates.xml
@@ -34,7 +34,7 @@
+ options="{'no_open': True}" context="{'tree_view_ref': 'soong_workflow.soong_workflow_record_no_action_tree'}"/>
@@ -91,7 +91,7 @@
+ options="{'no_open': True}" context="{'tree_view_ref': 'soong_workflow.soong_workflow_record_no_action_tree'}"/>
diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml
index 0dec4ceeb..2f82940bd 100644
--- a/soong_workflow/views/soong_workflow_record.xml
+++ b/soong_workflow/views/soong_workflow_record.xml
@@ -128,7 +128,54 @@
-
+
+ soong.workflow.record.tree
+ soong.workflow.record
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
soong.workflow.record.form
soong.workflow.record
diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py
index 3cd374f93..f31fd0a63 100644
--- a/yuthon_hr_attendance/models/overtime_approval.py
+++ b/yuthon_hr_attendance/models/overtime_approval.py
@@ -254,11 +254,10 @@ class OvertimeApprovals(models.Model):
def put_hr_employee(self):
for record in self:
for employee_id in record.employee_ids:
-
start_year = record.start_time.date().year
if record.company_id.name == "天河物管":
- start_date = datetime(start_year, 3, 1).date()
- valid_date = datetime(start_year + 1, 2, 1).date() + relativedelta(months=1) - relativedelta(days=1)
+ start_date = datetime(start_year, 9, 1).date()
+ valid_date = datetime(start_year + 1, 9, 1).date() + relativedelta(months=1) - relativedelta(days=1)
elif record.company_id.name == "天河粮储":
start_date = datetime(start_year, 7, 1).date()
valid_date = datetime(start_year + 1, 6, 30).date()
diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
index 54f51d73e..48eee60e9 100644
--- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py
+++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
@@ -963,6 +963,7 @@ class VacationOverline(models.Model):
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
workday = fields.Float(string='工作日')
+ last_balance = fields.Float(string='上年结余', compute='_compute_last_balance', store=True)
legal_day = fields.Float(string='法定节假日')
public_holidays = fields.Float(string='公休日')
meal_number = fields.Integer(string='误餐次数')
@@ -971,6 +972,7 @@ class VacationOverline(models.Model):
valid_date = fields.Date(string='有效期至')
adjust_date = fields.Date(string='调整至')
leave_date = fields.Date(string='请假日期')
+ total = fields.Float(string='总时长', compute='_compute_total')
overtime_methods = fields.Selection([('leave', '补休'), ('fee', '加班费结算')], string='加班补偿方式', default='leave')
text = fields.Text(string='备注')
is_confirm = fields.Boolean(string="是否确认")
@@ -983,12 +985,17 @@ class VacationOverline(models.Model):
duration = fields.Float(string="加班时长", compute="_compute_overtime", store=True)
carry_forward_quantity = fields.Float(string="结转时长")
validity = fields.Char(string="有效期")
+ carry_result = fields.Selection([('success', '成功'), ('failed', '失败')], string="结转结果")
+ is_active = fields.Boolean(string="归档")
carry_forward_state = fields.Selection([('pending', '待结转'),('completed', '已结转'), ('partial', '部分结转')
],string='结转状态',
default='pending',
)
remaining_quantity = fields.Float(string='剩余数', compute="_compute_remaining_quantity", store=True)
+ def confirm(self):
+ pass
+
def update_line(self):
over_ids = self.env["vacation.over.line"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -996,11 +1003,32 @@ class VacationOverline(models.Model):
rec._compute_remaining_quantity()
rec._compute_overtime()
rec._compute_employee_id()
+ rec._compute_last_balance()
- @api.depends('duration', 'carry_forward_quantity')
+ @api.depends('public_holidays', 'workday', 'last_balance', 'valid_date')
+ def _compute_total(self):
+ current_date = date.today()
+ for record in self:
+ last_balance_contribution = record.last_balance
+ if record.valid_date and current_date > record.valid_date:
+ last_balance_contribution = 0.0
+ if record.is_initial_number:
+ record.total = record.duration
+ else:
+ record.total = record.public_holidays + record.workday + last_balance_contribution
+
+ @api.depends('total', 'carry_forward_quantity')
def _compute_remaining_quantity(self):
for rec in self:
- rec.remaining_quantity = rec.duration - rec.carry_forward_quantity
+ rec.remaining_quantity = rec.total - rec.carry_forward_quantity
+
+ @api.depends('vacation_id')
+ def _compute_last_balance(self):
+ for rec in self:
+ if rec.vacation_id:
+ rec.last_balance = rec.vacation_id.last_holiday + rec.vacation_id.last_workday
+ else:
+ rec.last_balance = 0
@api.depends('vacation_id')
def _compute_employee_id(self):
diff --git a/yuthon_hr_attendance/static/src/js/button_vacation_put.js b/yuthon_hr_attendance/static/src/js/button_vacation_put.js
index bb3774b4c..965dbcbb8 100644
--- a/yuthon_hr_attendance/static/src/js/button_vacation_put.js
+++ b/yuthon_hr_attendance/static/src/js/button_vacation_put.js
@@ -13,11 +13,11 @@ export class CustomAttendanceVacationPutController extends ListController {
type: 'ir.actions.act_window',
res_model: 'hr.leave',
name: '请假情况',
- view_mode: 'tree',
- view_type: 'form',
- views: [["yuthon_hr_attendance.view_hr_leave_statement_tree", 'tree']],
+ view_mode: 'tree,form',
+ view_type: 'tree',
+ views: [[false, 'tree']],
target: 'new', // 弹窗形式打开
- context: {},
+ context: {'tree_view_ref': "yuthon_hr_attendance.view_hr_leave_statement_tree"},
});
}
@@ -30,7 +30,24 @@ export class CustomAttendanceVacationPutController extends ListController {
view_type: 'form',
views: [[false, 'tree']],
target: 'new',
- context: {},
+ context: {'tree_view_ref': "yuthon_hr_attendance.view_yuthon_vacation_overtime_briefly_tree"},
+ domain: [
+ '|',
+ // 条件1:is_initial_number=true → 无视时间,直接显示
+ ['is_initial_number', '=', true],
+ // 条件组2:is_initial_number=false + add + workflow_record_id≠空 + 非12月
+ '&', // 且:作用于「条件2」和「运算符&的结果」
+ ['is_initial_number', '=', false],
+ '&', // 且:作用于「条件3」和「运算符&的结果」
+ ['update_type', '=', 'add'],
+ '&', // 且:作用于「条件4」和「运算符!的结果」
+ ['workflow_record_id', '!=', false],
+ // 时间过滤:只作用于第二类记录
+ '!', // 取反:不是2025年12月
+ '&',
+ ['start_time', '>=', '2025-12-01 00:00:00'],
+ ['start_time', '<', '2026-01-01 00:00:00']
+ ],
});
}
@@ -43,7 +60,8 @@ export class CustomAttendanceVacationPutController extends ListController {
view_type: 'form',
views: [[false, 'tree']],
target: 'new',
- context: {},
+ context: {'tree_view_ref': "yuthon_hr_attendance.view_yuthon_vacation_meal_tree"},
+ domain: [['meal_fee', '!=', 0]]
});
}
}
diff --git a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
index 5c3bc11af..8f0308028 100644
--- a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
+++ b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
@@ -514,6 +514,37 @@
+
+ vacation.over.line.overtime.briefly.tree
+ vacation.over.line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ vacation.over.line.overtime.tree
+ vacation.over.line
+
+
+
+
+
+
+
+
+
+
+
+
vacation.over.line.overtime.tree
vacation.over.line
@@ -561,6 +592,15 @@
{'search_default_now_month': 1, 'search_default_group_by_employee_id':1}
+
+
+ 加班情况(归档)
+ vacation.over.line
+ tree
+ ['|', ('workflow_record_id','!=', False), ('is_initial_number', '=', True), ('update_type', '=', 'add'), ('is_active', '=', True)]
+ {'search_default_group_by_employee_id':1}
+
+
触发计算逻辑
diff --git a/yuthon_hr_attendance/wizard/pay_carryover_wizard.py b/yuthon_hr_attendance/wizard/pay_carryover_wizard.py
index 2b3fecf76..b58c1fc8f 100644
--- a/yuthon_hr_attendance/wizard/pay_carryover_wizard.py
+++ b/yuthon_hr_attendance/wizard/pay_carryover_wizard.py
@@ -22,7 +22,7 @@ class PayCarryoverWizard(models.TransientModel):
is_2025_december = rec.vacation_date.year == 2026 and rec.vacation_date.month == 1
if rec.overtime_ids:
for overtime in rec.overtime_ids:
- if overtime.text == '上月额度继承' and overtime.workday > 40:
+ if overtime.text == '上月额度继承' and overtime.total > 40:
reduce_workday = overtime.workday - 40
new_overtime = self.env['vacation.over.line'].create([{
'vacation_id': rec.id,
@@ -33,7 +33,7 @@ class PayCarryoverWizard(models.TransientModel):
'update_date': fields.Date.today(),
'is_void': False,
'overtime_methods': 'fee',
- 'text': f'{self.select_time}月份加班结算',
+ 'text': f'{rec.vacation_date.month}月份加班结算',
}])
if is_2025_december and overtime.is_initial_number:
overtime.write({
diff --git a/yuthon_official/security/yuthon_official_group.xml b/yuthon_official/security/yuthon_official_group.xml
index 88cd332af..8a3ec0d37 100644
--- a/yuthon_official/security/yuthon_official_group.xml
+++ b/yuthon_official/security/yuthon_official_group.xml
@@ -15,29 +15,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file