添加功能

This commit is contained in:
zhouzhou
2024-11-28 14:29:03 +08:00
parent b86302cc1b
commit 10832a8103
11 changed files with 174 additions and 76 deletions
@@ -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="中断工作月数")
+1
View File
@@ -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,
+2 -1
View File
@@ -1,2 +1,3 @@
from . import inherit_hr_payroll_structure
from . import inherit_hr_salary_rule
from . import inherit_hr_salary_rule
from . import inherit_hr_payroll_structure_type
@@ -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
@@ -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='所属公司')
@@ -16,4 +16,5 @@ class InheritHrSalaryRule(models.Model):
"res_model": "yuthon.salary.wizard",
"view_mode": "form",
"target": "new",
}
}
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_hr_payroll_structure_type_tree" model="ir.ui.view">
<field name="name">hr.payroll.structure.type.tree</field>
<field name="model">hr.payroll.structure.type</field>
<field name="inherit_id" ref="hr_payroll.hr_payroll_structure_type_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='name']" position="before">
<field name="sequence"/>
</xpath>
<xpath expr="//tree/field[@name='country_id']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='default_struct_id']" position="before">
<field name="yuthon_company"/>
</xpath>
</field>
</record>
<record id="view_hr_payroll_structure_type_form" model="ir.ui.view">
<field name="name">hr.payroll.structure.type.form</field>
<field name="model">hr.payroll.structure.type</field>
<field name="inherit_id" ref="hr_payroll.hr_payroll_structure_type_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='wage_type']" position="after">
<field name="yuthon_company"/>
</xpath>
<xpath expr="//field[@name='default_struct_id']" position="attributes">
<attribute name="domain" remove="1"/>
</xpath>
</field>
</record>
<record id="action_view_hr_payroll_structure_type_form1" model="ir.actions.act_window">
<field name="name">天河投资</field>
<field name="res_model">hr.payroll.structure.type</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv_id': 1}</field>
<field name="domain">[('yuthon_company', '=' , 'thtz')]</field>
</record>
<record id="action_view_hr_payroll_structure_type_form2" model="ir.actions.act_window">
<field name="name">天河粮储</field>
<field name="res_model">hr.payroll.structure.type</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="domain">[('yuthon_company', '=', 'thlc')]</field>
</record>
<record id="action_view_hr_payroll_structure_type_form3" model="ir.actions.act_window">
<field name="name">天河物管</field>
<field name="res_model">hr.payroll.structure.type</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="domain">[('yuthon_company', '=', 'thwg')]</field>
</record>
</odoo>
@@ -15,8 +15,8 @@
<attribute name="string">职级名称</attribute>
</xpath>
<xpath expr="//field[@name='name']" position="before">
<field name="lv"/>
<field name="sequence"/>
<field name="lv_id"/>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<field name="yuthon_company"/>
@@ -32,10 +32,11 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='country_id']" position="after">
<field name="sequence"/>
<field name="lv"/>
<field name="lv_id"/>
<field name="yuthon_company"/>
<field name="create_time"/>
<field name="end_time"/>
<field name="is_enable"/>
</xpath>
<xpath expr="//div[@class='oe_title']/label" position="attributes">
<attribute name="string">职级名称</attribute>
@@ -50,7 +51,7 @@
<group expand="0">
<filter name="group_date" string="查询年月" context="{'group_by': 'create_time'}"/>
<filter name="group_company" string="所属公司" context="{'group_by': 'yuthon_company'}"/>
<filter name="group_lv" string="级别" context="{'group_by': 'lv'}"/>
<filter name="group_lv_id" string="级别" context="{'group_by': 'lv_id'}"/>
</group>
</search>
</field>
@@ -59,27 +60,27 @@
<field name="name">全部</field>
<field name="res_model">hr.payroll.structure</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="context">{'search_default_group_lv_id': 1}</field>
</record>
<record id="action_view_hr_payroll_structure_list_form1" model="ir.actions.act_window">
<field name="name">天河投资</field>
<field name="res_model">hr.payroll.structure</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="context">{'search_default_group_lv_id': 1}</field>
<field name="domain">[('yuthon_company', '=' , 'thtz')]</field>
</record>
<record id="action_view_hr_payroll_structure_list_form2" model="ir.actions.act_window">
<field name="name">天河粮储</field>
<field name="res_model">hr.payroll.structure</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="context">{'search_default_group_lv_id': 1}</field>
<field name="domain">[('yuthon_company', '=', 'thlc')]</field>
</record>
<record id="action_view_hr_payroll_structure_list_form3" model="ir.actions.act_window">
<field name="name">天河物管</field>
<field name="res_model">hr.payroll.structure</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_lv': 1}</field>
<field name="context">{'search_default_group_lv_id': 1}</field>
<field name="domain">[('yuthon_company', '=', 'thwg')]</field>
</record>
</odoo>
@@ -11,12 +11,16 @@
<xpath expr="//field[@name='category_id']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='code']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='code']" position="after">
<field name="yuthon_company"/>
<field name="yuthon_company" optional="hide"/>
<field name="amount_select"/>
<field name="amount_fix"/>
</xpath>
</field>
</record>
+41 -18
View File
@@ -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',
}
+45 -43
View File
@@ -349,56 +349,63 @@
name="配置"
parent="human_resources_salary_root_board"
sequence="99"/>
<menuitem id="human_pay_setting_structural_root_board"
name="职级"
<menuitem id="human_pay_setting_structural_tt_board"
name="天河投资"
parent="human_pay_setting_root_board"
sequence="1"/>
<menuitem id="human_pay_setting_structural_root_board1"
name="全部"
parent="human_pay_setting_structural_root_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form"
<menuitem id="hr_payroll_structure_type_tt_board"
name="职级类型"
parent="human_pay_setting_structural_tt_board"
action="yuthon_salary.action_view_hr_payroll_structure_type_form1"
sequence="1"/>
<menuitem id="human_pay_setting_structural_root_board2"
name="天河投资"
parent="human_pay_setting_structural_root_board"
<menuitem id="human_pay_setting_structural_tt_board1"
name="职级"
parent="human_pay_setting_structural_tt_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form1"
sequence="3"/>
<menuitem id="human_pay_setting_structural_root_board3"
name="天河粮储"
parent="human_pay_setting_structural_root_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form2"
sequence="5"/>
<menuitem id="human_pay_setting_structural_root_board4"
name="天河物管"
parent="human_pay_setting_structural_root_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form3"
sequence="7"/>
<menuitem id="human_pay_setting_type_rules_root_board"
<menuitem id="human_pay_setting_payroll_items_tt_board"
name="工资项"
parent="human_pay_setting_structural_tt_board"
action="yuthon_salary.action_salary_rule_form1"
sequence="7"/>
<menuitem id="human_pay_setting_structural_lc_board"
name="天河粮储"
parent="human_pay_setting_root_board"
sequence="3"/>
<menuitem id="hr_payroll_structure_type_lc_board"
name="职级类型"
parent="human_pay_setting_structural_lc_board"
action="yuthon_salary.action_view_hr_payroll_structure_type_form2"
sequence="1"/>
<menuitem id="human_pay_setting_structural_lc_board1"
name="职级"
parent="human_pay_setting_structural_lc_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form2"
sequence="3"/>
<menuitem id="human_pay_setting_payroll_items_lc_board"
name="工资项"
parent="human_pay_setting_structural_lc_board"
action="yuthon_salary.action_salary_rule_form2"
sequence="7"/>
<menuitem id="human_pay_setting_structural_wg_board"
name="天河物管"
parent="human_pay_setting_root_board"
sequence="5"/>
<menuitem id="human_pay_setting_rules_root_board1"
name="全部"
parent="human_pay_setting_type_rules_root_board"
action="yuthon_salary.action_salary_rule_form"
<menuitem id="hr_payroll_structure_type_wg_board"
name="职级类型"
parent="human_pay_setting_structural_wg_board"
action="yuthon_salary.action_view_hr_payroll_structure_type_form3"
sequence="1"/>
<menuitem id="human_pay_setting_rules_root_board2"
name="天河投资"
parent="human_pay_setting_type_rules_root_board"
action="yuthon_salary.action_salary_rule_form1"
sequence="3"/>
<menuitem id="human_pay_setting_rules_root_board3"
name="天河粮储"
parent="human_pay_setting_type_rules_root_board"
action="yuthon_salary.action_salary_rule_form2"
<menuitem id="human_pay_setting_structural_wg_board1"
name="职级"
parent="human_pay_setting_structural_wg_board"
action="yuthon_salary.action_view_hr_payroll_structure_list_form3"
sequence="5"/>
<menuitem id="human_pay_setting_rules_root_board4"
name="天河物管"
parent="human_pay_setting_type_rules_root_board"
<menuitem id="human_pay_setting_payroll_items_wg_board"
name="工资项"
parent="human_pay_setting_structural_wg_board"
action="yuthon_salary.action_salary_rule_form3"
sequence="7"/>
<menuitem id="human_pay_setting_type_rule_argument_root_board"
name="工资项参数"
parent="human_pay_setting_root_board"
@@ -409,11 +416,6 @@
parent="human_pay_setting_root_board"
action="hr_payroll.action_hr_salary_rule_category"
sequence="9"/>
<menuitem id="human_pay_setting_type_structural_root_board"
name="职级类型"
parent="human_pay_setting_root_board"
action="hr_payroll.action_hr_payroll_structure_type"
sequence="12"/>
<menuitem id="human_pay_setting_work_entry_root_board"
name="工作条目类型"
parent="human_pay_setting_root_board"