@@ -28,6 +28,7 @@ class YuthonHrDepartment(models.Model):
|
||||
else:
|
||||
code.department_code = code.department_code
|
||||
code.update_code()
|
||||
|
||||
def update_code(self):
|
||||
def cycle_code(parent,parent_code):
|
||||
for child in parent.lower_ids:
|
||||
@@ -35,4 +36,13 @@ class YuthonHrDepartment(models.Model):
|
||||
self.env['hr.department'].search([('id', '=', child.id.origin)]).write({'department_code': new_code})
|
||||
cycle_code(child,new_code)
|
||||
|
||||
cycle_code(self, self.department_code)
|
||||
cycle_code(self, self.department_code)
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for record in self:
|
||||
name = record.name
|
||||
if record.parent_id:
|
||||
name = f"({record.parent_id.name})-{name}"
|
||||
result.append((record.id, name))
|
||||
return result
|
||||
@@ -171,8 +171,9 @@ class YuthonHrEmployee(models.Model):
|
||||
for record in self:
|
||||
if record.social_insurance_time :
|
||||
today = datetime.now().date()
|
||||
delta = relativedelta(today, record.social_insurance_date)
|
||||
record.cumulative_work_month = delta.years * 12 + delta.months
|
||||
if record.social_insurance_date:
|
||||
delta = relativedelta(today, record.social_insurance_date)
|
||||
record.cumulative_work_month = delta.years * 12 + delta.months
|
||||
else:
|
||||
record.cumulative_work_month = 0
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ class YuthonJobLv(models.Model):
|
||||
number_str = "".join(match)
|
||||
try:
|
||||
number = int(number_str)
|
||||
return (not number_str.startswith('0'), number)
|
||||
return (not number_str.startswith('0'), number) # 取反,首位为0的在前面
|
||||
except ValueError:
|
||||
return (False, 0)
|
||||
return (False, 0) # 首位非0的放前面
|
||||
return (False, 0) # 首位非0的放前面
|
||||
|
||||
res.sort(key=sort_by_sequence_number)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "yuthon salary",
|
||||
'summary': "薪资管理",
|
||||
'description': """
|
||||
|
||||
""",
|
||||
'author': 'pengyuthon',
|
||||
'website': 'https://www.pengyuthon.com',
|
||||
'category': 'Human Resources/Attendances',
|
||||
'version': '0.1',
|
||||
'license': 'LGPL-3',
|
||||
'depends': ['mail', 'base', 'hr', 'yuthon_hr_employee','hr_payroll'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/inherit_hr_payroll_structure_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
from . import inherit_hr_payroll_structure
|
||||
@@ -0,0 +1,36 @@
|
||||
from odoo import api, fields, models, _
|
||||
import re
|
||||
|
||||
class HrPayrollStructure(models.Model):
|
||||
_inherit = 'hr.payroll.structure'
|
||||
_order = 'sequence asc'
|
||||
|
||||
lv = fields.Char(string="级别")
|
||||
name = fields.Char(string="级别名称")
|
||||
sequence = fields.Char(string='级别序号', store=True)
|
||||
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
|
||||
('tctj', '天投城建')], string='公司')
|
||||
create_time = fields.Datetime(string="生效日期", default=fields.Datetime.now)
|
||||
end_time = fields.Datetime(string="失效日期")
|
||||
|
||||
@api.model
|
||||
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
|
||||
res = super(HrPayrollStructure, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby,
|
||||
lazy=lazy)
|
||||
if 'lv' in groupby:
|
||||
def sort_by_sequence_number(item):
|
||||
lv = item.get('lv')
|
||||
if lv:
|
||||
rec = self.search([('lv', '=', lv)], limit=1)
|
||||
if rec and rec.sequence:
|
||||
match = re.findall(r'\d+', rec.sequence)
|
||||
if match:
|
||||
number_str = "".join(match)
|
||||
try:
|
||||
number = int(number_str)
|
||||
return (not number_str.startswith('0'), number)
|
||||
except ValueError:
|
||||
return (False, 0)
|
||||
return (False, 0) # 首位非0的放前面
|
||||
res.sort(key=sort_by_sequence_number)
|
||||
return res
|
||||
@@ -0,0 +1 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
|
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="hr_payroll_structure_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.payroll.structure.inherit</field>
|
||||
<field name="model">hr.payroll.structure</field>
|
||||
<field name="inherit_id" ref="hr_payroll.view_hr_payroll_structure_list_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='rule_ids']" position="attributes">
|
||||
<attribute name="column_invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='country_id']" position="attributes">
|
||||
<attribute name="column_invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="attributes">
|
||||
<attribute name="string">级别名称</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="before">
|
||||
<field name="lv"/>
|
||||
<field name="sequence"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<field name="yuthon_company"/>
|
||||
<field name="create_time"/>
|
||||
<field name="end_time"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_payroll_structure_inherit_form" model="ir.ui.view">
|
||||
<field name="name">hr.payroll.structure.inherit.form</field>
|
||||
<field name="model">hr.payroll.structure</field>
|
||||
<field name="inherit_id" ref="hr_payroll.view_hr_employee_grade_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='country_id']" position="after">
|
||||
<field name="lv"/>
|
||||
<field name="sequence"/>
|
||||
<field name="yuthon_company"/>
|
||||
<field name="create_time"/>
|
||||
<field name="end_time"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='oe_title']/label" position="attributes">
|
||||
<attribute name="string">级别名称</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_payroll_structure_search" model="ir.ui.view">
|
||||
<field name="name">hr.payroll.structure.inherit.search</field>
|
||||
<field name="model">hr.payroll.structure</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="职级查询">
|
||||
<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'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_payroll.action_view_hr_payroll_structure_list_form" 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>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -22,6 +22,7 @@
|
||||
'website',
|
||||
'yuthon_hr_employee',
|
||||
'yuthon_sps_approval',
|
||||
'yuthon_salary',
|
||||
'sale',
|
||||
'payment',
|
||||
'purchase',
|
||||
|
||||
@@ -514,17 +514,8 @@
|
||||
<menuitem id="human_work_entry_board"
|
||||
name="工作分录"
|
||||
parent="human_resources_salary_root_board"
|
||||
sequence="5"/>
|
||||
<menuitem id="human_salary_work_entry_board"
|
||||
name="工作分录"
|
||||
parent="human_work_entry_board"
|
||||
action="hr_work_entry.hr_work_entry_action"
|
||||
sequence="1"/>
|
||||
<menuitem id="human_salary_pending_leave_board"
|
||||
name="待报告休假"
|
||||
parent="human_work_entry_board"
|
||||
action="hr_payroll_holidays.hr_leave_work_entry_action"
|
||||
sequence="3"/>
|
||||
sequence="5"/>
|
||||
<menuitem id="human_pay_slips_root_board"
|
||||
name="工资条"
|
||||
parent="human_resources_salary_root_board"
|
||||
@@ -543,54 +534,36 @@
|
||||
name="配置"
|
||||
parent="human_resources_salary_root_board"
|
||||
sequence="99"/>
|
||||
<menuitem id="human_pay_setting_set_root_board"
|
||||
name="设置"
|
||||
parent="human_pay_setting_root_board"
|
||||
action="hr_payroll.action_hr_payroll_configuration"
|
||||
sequence="1"/>
|
||||
<menuitem id="human_pay_setting_work_entry_root_board"
|
||||
name="工作分录"
|
||||
parent="human_pay_setting_root_board"
|
||||
sequence="3"/>
|
||||
<menuitem id="human_pay_setting_work_entry_type_root_board"
|
||||
name="工作条目类型"
|
||||
parent="human_pay_setting_work_entry_root_board"
|
||||
action="hr_work_entry.hr_work_entry_type_action"
|
||||
sequence="1"/>
|
||||
<menuitem id="human_pay_setting_work_entry_time_root_board"
|
||||
name="工作时间表"
|
||||
parent="human_pay_setting_work_entry_root_board"
|
||||
action="resource.action_resource_calendar_form"
|
||||
sequence="3"/>
|
||||
<menuitem id="human_pay_setting_type_root_board"
|
||||
name="工资"
|
||||
parent="human_pay_setting_root_board"
|
||||
sequence="3"/>
|
||||
<menuitem id="human_pay_setting_type_structural_root_board"
|
||||
name="结构类型"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
action="hr_payroll.action_hr_payroll_structure_type"
|
||||
sequence="1"/>
|
||||
<menuitem id="human_pay_setting_structural_root_board"
|
||||
name="结构"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
name="职级"
|
||||
parent="human_pay_setting_root_board"
|
||||
action="hr_payroll.action_view_hr_payroll_structure_list_form"
|
||||
sequence="3"/>
|
||||
sequence="1"/>
|
||||
<menuitem id="human_pay_setting_type_rules_root_board"
|
||||
name="工资项"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
parent="human_pay_setting_root_board"
|
||||
action="hr_payroll.action_salary_rule_form"
|
||||
sequence="5"/>
|
||||
<menuitem id="human_pay_setting_type_rule_argument_root_board"
|
||||
name="规则参数"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
name="工资项参数"
|
||||
parent="human_pay_setting_root_board"
|
||||
action="hr_payroll.hr_rule_parameter_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="human_pay_setting_type_rule_type_root_board"
|
||||
name="规则类别"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
name="工资项类别"
|
||||
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"
|
||||
action="hr_work_entry.hr_work_entry_type_action"
|
||||
sequence="15"/>
|
||||
<!-- 绩效考核 -->
|
||||
<menuitem id="yuthon_performance_menu_config_root_board"
|
||||
name="绩效考核"
|
||||
|
||||
Reference in New Issue
Block a user