From be3d57659422de4a11393c0b4ac9532ec081112e Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 17 Mar 2025 18:11:33 +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_salary/models/yuthon_payroll_project.py | 11 +++++++++++ yuthon_salary/views/inherit_hr_payslip_views.xml | 6 +++--- yuthon_salary/views/yuthon_payroll_project_views.xml | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 04924839e..07a09645b 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -8,12 +8,14 @@ class YuthonPayrollCommon(models.Model): _description = '薪资常用项' name = fields.Char(string='工资项名称') + sequence = fields.Char(string='级别序号', store=True) yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司') department_id = fields.Many2one('hr.department', string="部门") conditional_formulas = fields.Char(string='条件公式') # todo 可能是个many2one start_date = fields.Date(string="生效日期", default=fields.Date.today()) end_date = fields.Date(string="失效日期") + is_enable = fields.Boolean(string="启用", default=True) def create_salary_common(self): """ @@ -38,6 +40,15 @@ class YuthonPayrollCommon(models.Model): }]) sal.write({'rule_ids': rule_list}) + @api.depends('start_date', 'end_date') + def compute_is_enable(self): + for rec in self: + if rec.start_date and rec.end_date: + if rec.start_date <= fields.Date.today() < rec.end_date: + rec.is_enable = True + else: + rec.is_enable = False + class YuthonPayrollTemporary(models.Model): _name = 'yuthon.payroll.temporary' diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 0bedb40bb..d4b55ddde 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -26,9 +26,9 @@ - - - + + + diff --git a/yuthon_salary/views/yuthon_payroll_project_views.xml b/yuthon_salary/views/yuthon_payroll_project_views.xml index b9cdfb8cf..4f9e41690 100644 --- a/yuthon_salary/views/yuthon_payroll_project_views.xml +++ b/yuthon_salary/views/yuthon_payroll_project_views.xml @@ -5,12 +5,14 @@ yuthon.payroll.common + +