diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 2064c3eb4..78d249e70 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -8,11 +8,13 @@ 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='条件公式') 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): """ @@ -56,6 +58,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 + +