diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index 5c8749ebe..b399c3b9a 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -67,7 +67,7 @@ class YuthonHrEmployee(models.Model): new_end_contract_data = fields.Date(string="合同终止日期") open_start_time = fields.Date(string="参加工作时间") social_insurance_date = fields.Date(string="缴纳社保日期") - social_insurance_time = fields.Char(string="社保时长", compute='_compute_social_insurance_time', store=True) + social_insurance_time = fields.Char(string="社保时长", compute='_compute_social_insurance_info', store=True) compute_month = fields.Integer(string="社保时长假期") open_start_time_today = fields.Date(string="工作至今") interrupt_work_month = fields.Integer(string="中断工作月数") diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index dc1e12bb9..76a12b4b2 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -15,6 +15,7 @@ 'security/ir.model.access.csv', 'views/inherit_hr_payroll_structure_views.xml', 'views/inherit_hr_salary_rule_views.xml', + 'views/inherit_hr_payroll_structure_type_views.xml', 'wizard/yuthon_salary_wizard_views.xml', ], 'installable': True, diff --git a/yuthon_salary/models/__init__.py b/yuthon_salary/models/__init__.py index f159463b8..ad5471448 100644 --- a/yuthon_salary/models/__init__.py +++ b/yuthon_salary/models/__init__.py @@ -1,2 +1,3 @@ from . import inherit_hr_payroll_structure -from . import inherit_hr_salary_rule \ No newline at end of file +from . import inherit_hr_salary_rule +from . import inherit_hr_payroll_structure_type \ No newline at end of file diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index ad050f45e..09d59092c 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -5,12 +5,13 @@ class HrPayrollStructure(models.Model): _inherit = 'hr.payroll.structure' _order = 'sequence asc' - lv = fields.Char(string="级别") + lv_id = fields.Many2one('hr.payroll.structure.type', string="级别") name = fields.Char(string="职级名称") - sequence = fields.Char(string='级别序号', store=True) + sequence = fields.Char(related='lv_id.sequence', string='级别序号', store=True) yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='所属公司') - create_time = fields.Datetime(string="生效日期", default=fields.Datetime.now) - end_time = fields.Datetime(string="失效日期") + create_time = fields.Date(string="生效日期", default=fields.Date.today()) + end_time = fields.Date(string="失效日期") + is_enable = fields.Boolean(string="启用", default=True) type_id = fields.Many2one('hr.payroll.structure.type', string="岗位类别",required=False) @api.model diff --git a/yuthon_salary/models/inherit_hr_payroll_structure_type.py b/yuthon_salary/models/inherit_hr_payroll_structure_type.py new file mode 100644 index 000000000..72f4b73ea --- /dev/null +++ b/yuthon_salary/models/inherit_hr_payroll_structure_type.py @@ -0,0 +1,11 @@ +from odoo import api, fields, models, _ +import re + +class HrPayrollStructureType(models.Model): + _inherit = 'hr.payroll.structure.type' + _description = '职级类别' + + name = fields.Char(string='职级类别', required=True) + sequence = fields.Char(string='职级序号') + yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], + string='所属公司') \ No newline at end of file diff --git a/yuthon_salary/models/inherit_hr_salary_rule.py b/yuthon_salary/models/inherit_hr_salary_rule.py index ff70f157c..0682ce493 100644 --- a/yuthon_salary/models/inherit_hr_salary_rule.py +++ b/yuthon_salary/models/inherit_hr_salary_rule.py @@ -16,4 +16,5 @@ class InheritHrSalaryRule(models.Model): "res_model": "yuthon.salary.wizard", "view_mode": "form", "target": "new", - } \ No newline at end of file + } + diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_type_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_type_views.xml new file mode 100644 index 000000000..6e3e5f13c --- /dev/null +++ b/yuthon_salary/views/inherit_hr_payroll_structure_type_views.xml @@ -0,0 +1,53 @@ + + + + hr.payroll.structure.type.tree + hr.payroll.structure.type + + + + + + + 1 + + + + + + + + hr.payroll.structure.type.form + hr.payroll.structure.type + + + + + + + + + + + + 天河投资 + hr.payroll.structure.type + tree,form,search + {'search_default_group_lv_id': 1} + [('yuthon_company', '=' , 'thtz')] + + + 天河粮储 + hr.payroll.structure.type + tree,form,search + {'search_default_group_lv': 1} + [('yuthon_company', '=', 'thlc')] + + + 天河物管 + hr.payroll.structure.type + tree,form,search + {'search_default_group_lv': 1} + [('yuthon_company', '=', 'thwg')] + + \ 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 4ccd433d0..0bda1a3b4 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -15,8 +15,8 @@ 职级名称 - + @@ -32,10 +32,11 @@ - + + 职级名称 @@ -50,7 +51,7 @@ - + @@ -59,27 +60,27 @@ 全部 hr.payroll.structure tree,form,search - {'search_default_group_lv': 1} + {'search_default_group_lv_id': 1} 天河投资 hr.payroll.structure tree,form,search - {'search_default_group_lv': 1} + {'search_default_group_lv_id': 1} [('yuthon_company', '=' , 'thtz')] 天河粮储 hr.payroll.structure tree,form,search - {'search_default_group_lv': 1} + {'search_default_group_lv_id': 1} [('yuthon_company', '=', 'thlc')] 天河物管 hr.payroll.structure tree,form,search - {'search_default_group_lv': 1} + {'search_default_group_lv_id': 1} [('yuthon_company', '=', 'thwg')] \ No newline at end of file diff --git a/yuthon_salary/views/inherit_hr_salary_rule_views.xml b/yuthon_salary/views/inherit_hr_salary_rule_views.xml index a4c9f3ad5..bc16045a0 100644 --- a/yuthon_salary/views/inherit_hr_salary_rule_views.xml +++ b/yuthon_salary/views/inherit_hr_salary_rule_views.xml @@ -11,12 +11,16 @@ 1 + + 1 + 1 - + + diff --git a/yuthon_salary/wizard/yuthon_salary_wizard.py b/yuthon_salary/wizard/yuthon_salary_wizard.py index 6141994b4..d8ee1a0c7 100644 --- a/yuthon_salary/wizard/yuthon_salary_wizard.py +++ b/yuthon_salary/wizard/yuthon_salary_wizard.py @@ -55,27 +55,36 @@ class YuthonSalaryWizard(models.Model): yuthon_company_dict = {'天河投资集团': 'thtz', '天河物管': 'thwg', '天河粮储': 'thlc', '': ''} yuthon_company_dict2 = {'天河投资集团': 'TT', '天河物管': 'TW', '天河粮储': 'TL', '': ''} salary_name = self.env['hr.salary.rule'] + job = row[1].value text = row[2].value yuthon_company = yuthon_company_dict.get(row[10].value) - struct_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + struct_id = self.env['hr.payroll.structure'].search([('name', '=', job)]) if not struct_id: - struct_id = self.env['hr.payroll.structure'].create({ - 'name':text, - 'lv':row[1].value, - 'sequence':row[0].value, - 'yuthon_company':yuthon_company}) + struct_id = self.env['hr.payroll.structure.type'].create({ + 'name': job, + 'default_struct_id':struct_id, + 'sequence': row[0].value, + 'yuthon_company': yuthon_company}) + structure_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + if not structure_id: + structure_id = self.env['hr.payroll.structure'].create({ + 'name': text, + 'lv_id':struct_id.id, + 'sequence': row[0].value, + 'yuthon_company': yuthon_company,}) yuthon_company = yuthon_company_dict.get(row[10].value) yuthon_company2 = yuthon_company_dict2.get(row[10].value) - for salary in salary_dates: + for salary, r in salary_dates,row[3,9]: name_pinyin = pinyin(salary.value, style=Style.FIRST_LETTER) abbreviation = "".join([p[0][0] for p in name_pinyin]).upper() salary_date = { 'sequence': row[0].value, 'code':yuthon_company2+abbreviation, 'name': salary.value, # 姓名 - 'struct_id': struct_id.id, + 'struct_id': structure_id.id, 'yuthon_company': yuthon_company, 'amount_select' : 'fix', + 'amount_fix': r } salary_name.create(salary_date) @@ -83,15 +92,22 @@ class YuthonSalaryWizard(models.Model): yuthon_company_dict = {'天河投资集团': 'thtz', '天河物管': 'thwg', '天河粮储': 'thlc', '': ''} yuthon_company_dict2 = {'天河投资集团': 'TT', '天河物管': 'TW', '天河粮储': 'TL', '': ''} salary_name = self.env['hr.salary.rule'] + job = row[1].value text = row[2].value yuthon_company = yuthon_company_dict.get(row[11].value) - struct_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + struct_id = self.env['hr.payroll.structure.type'].search([('name', '=', job)]) if not struct_id: - struct_id = self.env['hr.payroll.structure'].create({ - 'name': text, - 'lv': row[1].value, + struct_id = self.env['hr.payroll.structure.type'].create({ + 'name': job, 'sequence': row[0].value, 'yuthon_company': yuthon_company}) + structure_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + if not structure_id: + structure_id = self.env['hr.payroll.structure'].create({ + 'name': text, + 'lv_id':struct_id.id, + 'sequence': row[0].value, + 'yuthon_company': yuthon_company,}) yuthon_company = yuthon_company_dict.get(row[11].value) yuthon_company2 = yuthon_company_dict2.get(row[11].value) for salary in salary_dates: @@ -101,7 +117,7 @@ class YuthonSalaryWizard(models.Model): 'sequence': row[0].value, 'code': yuthon_company2 + abbreviation, 'name': salary.value, # 姓名 - 'struct_id': struct_id.id, + 'struct_id': structure_id.id, 'yuthon_company': yuthon_company, 'amount_select': 'fix', } @@ -111,15 +127,22 @@ class YuthonSalaryWizard(models.Model): yuthon_company_dict = {'天河投资集团': 'thtz', '天河物管': 'thwg', '天河粮储': 'thlc', '': ''} yuthon_company_dict2 = {'天河投资集团': 'TT', '天河物管': 'TW', '天河粮储': 'TL', '': ''} salary_name = self.env['hr.salary.rule'] + job = row[1].value text = row[2].value yuthon_company = yuthon_company_dict.get(row[16].value) - struct_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + struct_id = self.env['hr.payroll.structure'].search([('name', '=', job)]) if not struct_id: - struct_id = self.env['hr.payroll.structure'].create({ - 'name': text, - 'lv': row[1].value, + struct_id = self.env['hr.payroll.structure.type'].create({ + 'name': job, 'sequence': row[0].value, 'yuthon_company': yuthon_company}) + structure_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + if not structure_id: + structure_id = self.env['hr.payroll.structure'].create({ + 'name': text, + 'lv_id': struct_id.id, + 'sequence': row[0].value, + 'yuthon_company': yuthon_company, }) yuthon_company = yuthon_company_dict.get(row[16].value) yuthon_company2 = yuthon_company_dict2.get(row[16].value) for salary in salary_dates: @@ -129,7 +152,7 @@ class YuthonSalaryWizard(models.Model): 'sequence': row[0].value, 'code': yuthon_company2 + abbreviation, 'name': salary.value, # 姓名 - 'struct_id': struct_id.id, + 'struct_id': structure_id.id, 'yuthon_company': yuthon_company, 'amount_select': 'fix', } diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 800179a4b..765b48cfe 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -349,56 +349,63 @@ name="配置" parent="human_resources_salary_root_board" sequence="99"/> - - - - - - - + + + + + - - - - - -