diff --git a/yuthon_hr_attendance/models/resource_calendar_leaves.py b/yuthon_hr_attendance/models/resource_calendar_leaves.py index a01720d9b..55bf96df6 100644 --- a/yuthon_hr_attendance/models/resource_calendar_leaves.py +++ b/yuthon_hr_attendance/models/resource_calendar_leaves.py @@ -118,7 +118,7 @@ class ResourceCalendarHolidaye(models.Model): class ResourceCalendarLeave(models.Model): _inherit = "resource.calendar.leaves" - is_holidays = fields.Boolean(string="法定节假日") + holidays = fields.Text(string="法定日") alternate_rest_day = fields.Text(string='调休休息日') shift_replacement_day = fields.Text(string='调班补办日') total_days = fields.Integer(string='总天数') \ No newline at end of file diff --git a/yuthon_hr_attendance/views/resource_calendar_leaves_views.xml b/yuthon_hr_attendance/views/resource_calendar_leaves_views.xml index f385192aa..9b47d1b95 100644 --- a/yuthon_hr_attendance/views/resource_calendar_leaves_views.xml +++ b/yuthon_hr_attendance/views/resource_calendar_leaves_views.xml @@ -69,16 +69,6 @@ - - resource.calendar.leaves.tree - resource.calendar.leaves - - - - - - - resource.calendar.leave.tree.inherit resource.calendar.leaves @@ -86,6 +76,7 @@ + @@ -98,6 +89,7 @@ + diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index 83471ede3..97d69a483 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -325,7 +325,6 @@ - @@ -356,6 +355,9 @@ 1 + + + diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index 4b7b08273..e13fede1f 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -24,6 +24,7 @@ 'wizard/yuthon_payroll_wizard_views.xml', 'wizard/salary_compute_wizard_views.xml', 'wizard/salary_payslip_wizard_views.xml', + 'wizard/select_delete_wizard_viwes.xml', ], 'assets': { 'web.assets_backend': [ diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index 36d193d3e..12690f814 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -164,4 +164,13 @@ class HrPayrollStructure(models.Model): } for company_code, field_mapping in company_mappings.items(): - self.generate_salary_rules(company_code, field_mapping) \ No newline at end of file + self.generate_salary_rules(company_code, field_mapping) + + def action_select_delete_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "选择删除", + "res_model": "select.delete.wizard", + "view_mode": "form", + "target": "new", + } \ No newline at end of file diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 558492b99..6a79a2553 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -10,11 +10,12 @@ class YuthonPayrollCommon(models.Model): name = fields.Char(string='工资项名称') sequence = fields.Char(string='序号', store=True) - yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')],string='公司') + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')],string='公司', default=lambda self: self.env.user.employee_id.yuthon_company) department_id = fields.Many2one('hr.department', string="部门") conditional_formulas = fields.Char(string='条件公式') start_date = fields.Date(string="生效日期", default=fields.Date.today()) end_date = fields.Date(string="失效日期") + before_tax = fields.Boolean(string="税前") is_enable = fields.Boolean(string="启用", default=True) def create_salary_common(self): diff --git a/yuthon_salary/security/ir.model.access.csv b/yuthon_salary/security/ir.model.access.csv index fb92d6a42..5e0d5121b 100644 --- a/yuthon_salary/security/ir.model.access.csv +++ b/yuthon_salary/security/ir.model.access.csv @@ -7,4 +7,5 @@ access_yuthon_payroll_insurances,access_yuthon_payroll_insurances,model_yuthon_p access_yuthon_payroll_wizard,access_yuthon_payroll_wizard,model_yuthon_payroll_wizard,base.group_user,1,1,1,1 access_salary_compute_wizard,access_salary_compute_wizard,model_salary_compute_wizard,base.group_user,1,1,1,1 access_yuthon_account_group,access_yuthon_account_group,model_yuthon_account_group,base.group_user,1,1,1,1 -access_salary_payslip_wizard,access_salary_payslip_wizard,model_salary_payslip_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_salary_payslip_wizard,access_salary_payslip_wizard,model_salary_payslip_wizard,base.group_user,1,1,1,1 +access_select_delete_wizard,access_select_delete_wizard,model_select_delete_wizard,base.group_user,1,1,1,1 \ 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 ec4d4ba7f..c2af631a2 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -117,4 +117,11 @@ code action = model.action_yuthon_payroll_wizard() + + 删除数据 + + + code + action = model.action_select_delete_wizard() + \ No newline at end of file diff --git a/yuthon_salary/views/yuthon_payroll_project_views.xml b/yuthon_salary/views/yuthon_payroll_project_views.xml index 4f9e41690..db28b5599 100644 --- a/yuthon_salary/views/yuthon_payroll_project_views.xml +++ b/yuthon_salary/views/yuthon_payroll_project_views.xml @@ -7,6 +7,7 @@ + diff --git a/yuthon_salary/wizard/__init__.py b/yuthon_salary/wizard/__init__.py index 8bb487f1c..9c836bfa7 100644 --- a/yuthon_salary/wizard/__init__.py +++ b/yuthon_salary/wizard/__init__.py @@ -1,4 +1,5 @@ from . import yuthon_salary_wizard from . import yuthon_payroll_wizard from . import salary_compute_wizard -from . import salary_payslip_wizard \ No newline at end of file +from . import salary_payslip_wizard +from . import select_delete_wizard \ No newline at end of file diff --git a/yuthon_salary/wizard/select_delete_wizard.py b/yuthon_salary/wizard/select_delete_wizard.py new file mode 100644 index 000000000..adbeec58a --- /dev/null +++ b/yuthon_salary/wizard/select_delete_wizard.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields, api, _, SUPERUSER_ID +from odoo.exceptions import ValidationError, UserError +from pypinyin import pinyin, Style +import xlrd +import base64 +import datetime +from datetime import datetime + + +class SelectDeleteWizard(models.Model): + _name = 'select.delete.wizard' + _description = '删除弹窗' + + name = fields.Char(string='删除', help='输入要删除的工资项') + + def confirm(self): + for record in self: + if record.name: + structure_ids = self.env['hr.payroll.structure'].search([]) + rules_to_delete = self.env['hr.salary.rule'] + for structure in structure_ids: + for rule in structure.rule_ids: + if rule.name == record.name: + rules_to_delete |= rule + if rules_to_delete: + rules_to_delete.unlink() \ No newline at end of file diff --git a/yuthon_salary/wizard/select_delete_wizard_viwes.xml b/yuthon_salary/wizard/select_delete_wizard_viwes.xml new file mode 100644 index 000000000..873965d02 --- /dev/null +++ b/yuthon_salary/wizard/select_delete_wizard_viwes.xml @@ -0,0 +1,21 @@ + + + + select.delete.wizard.form + select.delete.wizard + +
+ + + + + + +
+
+
+ +