diff --git a/yuthon_hr_employee/models/yuthon_medical_manage.py b/yuthon_hr_employee/models/yuthon_medical_manage.py index 602afec22..f019b383c 100644 --- a/yuthon_hr_employee/models/yuthon_medical_manage.py +++ b/yuthon_hr_employee/models/yuthon_medical_manage.py @@ -117,16 +117,20 @@ class YuthonMedicalManage(models.Model): current_date = fields.Date.today() current_year = str(current_date.year) last_year = str(int(current_year) - 1) - target_companies = ['广州市天河投资集团有限公司', '广州市天投城市建设开发有限公司', - '广州天投云擎数字科技有限公司', '广州市东进物业管理有限公司'] + valid_rules = self.env['yuthon.medical.rule'].search([ + ('start_date', '<=', current_date), + '|', ('end_date', '>=', current_date), ('end_date', '=', False) + ], order='start_date desc', limit=1) + rule = valid_rules + target_companies = rule.party_ids.mapped('name') party_setting_records = self.env['yuthon.party.setting'].search([ ('party', 'in', target_companies) ]).ids open_employees = self.env['hr.employee'].search([ ('user_state', '=', 'in'), ('company_id.name', '=', '集团本部'), + ('name', '=', '杨霖'), ('contract_id.party_id', 'in', party_setting_records), - ('active', '=', True) ]) for employee in open_employees: medical_manage_rec = self.env['yuthon.medical.manage'].search([ diff --git a/yuthon_hr_employee/models/yuthon_medical_rule.py b/yuthon_hr_employee/models/yuthon_medical_rule.py index ea9a5ebb2..ae01c86c6 100644 --- a/yuthon_hr_employee/models/yuthon_medical_rule.py +++ b/yuthon_hr_employee/models/yuthon_medical_rule.py @@ -12,6 +12,7 @@ class YuthonMedicalRule(models.Model): base_amount = fields.Float(string='基数金额') starting_age = fields.Integer(string='起始年龄') department_id = fields.Many2one("hr.department", string="部门") + party_ids = fields.Many2many('yuthon.party.setting', string='甲方(用人单位)') extension_years = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 13)], string='延续年限') increase_interval_years = fields.Integer(string='递增间隔(年)') increment_amount = fields.Float(string='递增金额') diff --git a/yuthon_hr_employee/views/yuthon_medical_rule_views.xml b/yuthon_hr_employee/views/yuthon_medical_rule_views.xml index 858a9173f..57886e064 100644 --- a/yuthon_hr_employee/views/yuthon_medical_rule_views.xml +++ b/yuthon_hr_employee/views/yuthon_medical_rule_views.xml @@ -14,6 +14,7 @@ +