diff --git a/yuthon_hr_employee/models/yuthon_medical_manage.py b/yuthon_hr_employee/models/yuthon_medical_manage.py index 483bc0bab..6fa42cd6a 100644 --- a/yuthon_hr_employee/models/yuthon_medical_manage.py +++ b/yuthon_hr_employee/models/yuthon_medical_manage.py @@ -9,6 +9,7 @@ class YuthonMedicalManage(models.Model): _description = '体检费管理' employee_id = fields.Many2one('hr.employee', string="员工姓名") + start_date = fields.Date(string='开始日期') year = fields.Char(string="年份") current_year_remaining = fields.Float(string="本年剩余", compute="_compute_current_year_remaining") remainder_the_year = fields.Float(string="本年剩余") @@ -32,6 +33,8 @@ class YuthonMedicalManage(models.Model): self._context.get('active_ids', self._context.get('active_id'))) for soong_id in soong_ids: soong_id.remainder_the_year = soong_id.this_year_quota + soong_id.last_year_balance - soong_id.this_year_usage + if soong_id.year: + soong_id.start_date = f"{soong_id.year}-01-01" @api.depends('employee_id', 'year') def _compute_last_year_used(self): @@ -127,6 +130,7 @@ class YuthonMedicalManage(models.Model): medical_manage_rec.write({'this_year_quota': this_year_quota, }) medical_manage_rec.remainder_the_year = medical_manage_rec.this_year_quota + medical_manage_rec.last_year_balance - medical_manage_rec.this_year_usage + medical_manage_rec.start_date = current_date # 回填上年数据 last_year_rec = self.env['yuthon.medical.manage'].search([