diff --git a/yuthon_hr_attendance/models/hr_attendance_month.py b/yuthon_hr_attendance/models/hr_attendance_month.py index a93645174..6c308afaa 100644 --- a/yuthon_hr_attendance/models/hr_attendance_month.py +++ b/yuthon_hr_attendance/models/hr_attendance_month.py @@ -98,7 +98,7 @@ class HrAttendanceMonthDetail(models.Model): leave_of_sick = fields.Integer(string="病假") statutory_leave = fields.Integer(string="法定假") work_overtime = fields.Integer(string="加班") - entry_date = fields.Date(string="入职时间") + entry_date = fields.Date(relatde='employee_id.open_start_time', string="入职时间") expected_date = fields.Date(string="离职日期") cop_leave = fields.Float(string='补休') annual_leave = fields.Float(string='年假') @@ -121,7 +121,7 @@ class HrAttendanceMonthDetail(models.Model): come_late = fields.Integer(string="迟到") is_early_card = fields.Integer(string="早退") is_no_card = fields.Integer(string="缺卡") - is_work = fields.Boolean(string='旷工') + is_work = fields.Integer(string='旷工') # 假期 unpaid_leave = fields.Integer(string="无薪假") diff --git a/yuthon_property_approval/models/property_handover.py b/yuthon_property_approval/models/property_handover.py index 3a1e14210..209f54709 100644 --- a/yuthon_property_approval/models/property_handover.py +++ b/yuthon_property_approval/models/property_handover.py @@ -15,7 +15,7 @@ class PropertyHandover(models.Model): code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_handover_code')) property_documents_ids = fields.Many2many('documents.document', string="附件") - source = fields.Char(string="移交单位") + source = fields.Char(string="接收单位") source_time = fields.Date(string="移交时间") is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index e75e1e554..2faede898 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -124,4 +124,58 @@ class HrPayrollStructure(models.Model): "res_model": "yuthon.payroll.wizard", "view_mode": "form", "target": "new", - } \ No newline at end of file + } + + def generate_salary_rules(self, company_code, field_mapping): + # 搜索符合条件的薪资结构 + structure_ids = self.env['hr.payroll.structure'].search([('yuthon_company', '=', company_code)]) + for structure in structure_ids: + # 清空当前结构的规则 + structure.rule_ids.unlink() + # 初始化规则列表 + rule_list = [] + for rule_name, field_attr in field_mapping.items(): + field_amount = getattr(structure, field_attr) + if field_amount is not None: + name_pinyin = pinyin(rule_name, style=Style.FIRST_LETTER) + code = "".join([p[0][0] for p in name_pinyin]).upper() + category_id = self.env['hr.salary.rule.category'].search([('name', '=', '职级')], limit=1) + rule_list.append([0, 0, { + 'name': rule_name, + 'category_id': category_id.id, + 'code': code, + 'yuthon_company': company_code, + 'amount_fix': field_amount, + 'struct_id': structure.id + }]) + if rule_list: + structure.write({'rule_ids': rule_list}) + + def salary_rule_data(self): + # 定义不同公司的字段映射 + company_mappings = { + 'thwg': { + '基本工资': 'base_salary', + '岗位工资': 'position_salary', + '综合补贴': 'integrated_subsidy', + '通讯补贴': 'communication_subsidy', + '全勤奖': 'full_attendance_bonus' + }, + 'thlc': { + '基本工资': 'base_salary', + '岗位工资': 'position_salary', + '岗位补贴': 'position_subsidy', + '绩效奖金': 'performance_bonus' + }, + 'thtz': { + '基本工资': 'base_salary', + '职级工资': 'rank_salary', + '绩效奖金': 'performance_bonus', + '通讯补贴': 'communication_subsidy', + '全勤奖': 'full_attendance_bonus' + } + } + + for record in self: + for company_code, field_mapping in company_mappings.items(): + self.generate_salary_rules(company_code, field_mapping) \ No newline at end of file diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index e3778bd39..69fca5cb2 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -19,6 +19,7 @@