diff --git a/yuthon_hr_attendance/models/yuthon_duty_arrangement.py b/yuthon_hr_attendance/models/yuthon_duty_arrangement.py index 0192c7fd4..71c936465 100644 --- a/yuthon_hr_attendance/models/yuthon_duty_arrangement.py +++ b/yuthon_hr_attendance/models/yuthon_duty_arrangement.py @@ -44,7 +44,7 @@ class YuthonDutyArrangement(models.Model): for record in self: if record.start_time: weekday = record.start_time.weekday() - record.is_weekend = weekday in (5, 6) # 5 和 6 分别代表周六和周日 + record.is_weekend = weekday in (5, 6) else: record.is_weekend = False diff --git a/yuthon_hr_attendance/models/yuthon_duty_plan.py b/yuthon_hr_attendance/models/yuthon_duty_plan.py index 3195729bc..865fd4873 100644 --- a/yuthon_hr_attendance/models/yuthon_duty_plan.py +++ b/yuthon_hr_attendance/models/yuthon_duty_plan.py @@ -13,6 +13,7 @@ class YuthonDutyPlan(models.Model): is_enable = fields.Boolean(string="启用", default=True) plan_line_ids = fields.One2many('duty.plan.line', 'duty_plan_id', string='关联计划明细') + class DutyPlanLine(models.Model): _name = 'duty.plan.line' _description = '值班计划明细行' diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index 476221f2a..4ccd433d0 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -55,10 +55,31 @@ - - 薪资管理 + + 全部 hr.payroll.structure tree,form,search {'search_default_group_lv': 1} + + 天河投资 + hr.payroll.structure + tree,form,search + {'search_default_group_lv': 1} + [('yuthon_company', '=' , 'thtz')] + + + 天河粮储 + hr.payroll.structure + tree,form,search + {'search_default_group_lv': 1} + [('yuthon_company', '=', 'thlc')] + + + 天河物管 + hr.payroll.structure + 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_salary_rule_views.xml b/yuthon_salary/views/inherit_hr_salary_rule_views.xml index 6d87df537..a4c9f3ad5 100644 --- a/yuthon_salary/views/inherit_hr_salary_rule_views.xml +++ b/yuthon_salary/views/inherit_hr_salary_rule_views.xml @@ -16,6 +16,7 @@ + @@ -30,6 +31,34 @@ + + 全部 + hr.salary.rule + tree,kanban,form + {'search_default_group_by_struct_id': 1} + + + 天河投资 + hr.salary.rule + tree,form + {'search_default_group_by_struct_id': 1} + [('yuthon_company','=','thtz')] + + + 天河粮储 + hr.salary.rule + tree,kanban,form + {'search_default_group_by_struct_id': 1} + [('yuthon_company','=','thlc')] + + + 天河物管 + hr.salary.rule + tree,kanban,form + {'search_default_group_by_struct_id': 1} + [('yuthon_company','=','thwg')] + + 批量导入职级 diff --git a/yuthon_salary/wizard/yuthon_salary_wizard.py b/yuthon_salary/wizard/yuthon_salary_wizard.py index 129c614c0..79263fa57 100644 --- a/yuthon_salary/wizard/yuthon_salary_wizard.py +++ b/yuthon_salary/wizard/yuthon_salary_wizard.py @@ -22,9 +22,14 @@ class YuthonSalaryWizard(models.Model): raise ValidationError('请上传文件。') book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file)) sh = book.sheet_by_index(0) - for rx in range(1, sh.nrows): + salary_dates = [] + for rx in range(0, sh.nrows): row = sh.row(rx) - self.salary_user_data(row) + if rx == 0: + for r in row[3:9]: + salary_dates.append(r) + else: + self.salary_user_data(row,salary_dates) return { 'name': '批量更新工资项', 'type': 'ir.actions.act_window', @@ -32,22 +37,32 @@ class YuthonSalaryWizard(models.Model): 'res_model': 'hr.salary.rule', } - def salary_user_data(self,row): - name_pinyin = pinyin(row[1].value, style=Style.FIRST_LETTER) - abbreviation = "".join([p[0][0] for p in name_pinyin]).upper() - salary_name = self.env['hr.salary.rule'].search([('name', '=', row[1].value)]) - text = row[2].value - struct_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + def salary_user_data(self,row,salary_dates): yuthon_company_dict = {'天河投资集团': 'thtz', '天河物管': 'thwg', '天河粮储': 'thlc', '': ''} yuthon_company_dict2 = {'天河投资集团': 'TT', '天河物管': 'TW', '天河粮储': 'TL', '': ''} - yuthon_company = yuthon_company_dict.get(row[3].value) - yuthon_company2 = yuthon_company_dict2.get(row[3].value) - salary_date = { - 'sequence': row[0].value, - 'code':yuthon_company2+abbreviation, - 'name': row[1].value, # 姓名 - 'struct_id': struct_id.id, # 部门 - 'yuthon_company': yuthon_company, - 'amount_fix' : row[4].value, # 固定金额 - } - salary_name.create(salary_date) + salary_name = self.env['hr.salary.rule'] + text = row[2].value + yuthon_company = yuthon_company_dict.get(row[10].value) + struct_id = self.env['hr.payroll.structure'].search([('name', '=', text)]) + if struct_id: + pass + else: + struct_id = self.env['hr.payroll.structure'].create({ + 'name':text, + 'lv':row[1].value, + '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: + 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, + 'yuthon_company': yuthon_company, + 'amount_select' : 'fix', + } + salary_name.create(salary_date) \ No newline at end of file diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index cb45ba5be..f9836f945 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -324,13 +324,53 @@ + + + + + + + + + +