!1746 添加功能

Merge pull request !1746 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-03-11 02:13:04 +00:00
committed by Gitee
10 changed files with 69 additions and 20 deletions
@@ -43,6 +43,7 @@ class YuthonHrEmployee(models.Model):
# 个人信息
user_salary = fields.Float(string="基本工资")
job_lv_salary = fields.Float(string="职级工资")
salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组")
user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别")
@@ -13,4 +13,11 @@ class YuthonPartySetting(models.Model):
economy_type = fields.Char(string='经济类型')
address = fields.Text(string='通讯地址')
contact = fields.Char(string='联系人')
phone = fields.Char(string='电话')
phone = fields.Char(string='电话')
class YuthonSalaryGroup(models.Model):
_name = 'yuthon.salary.group'
_description = '工资单分组'
name = fields.Char(string='名称', required=True)
@@ -18,4 +18,5 @@ access_hr_job_add_wizard,hr_job_add_wizard,model_hr_job_add_wizard,base.group_us
access_yuthon_party_setting,yuthon_party_setting,model_yuthon_party_setting,base.group_user,1,1,1,1
access_yuthon_medical_rule,yuthon_medical_rule,model_yuthon_medical_rule,base.group_user,1,1,1,1
access_yuthon_medical_manage,yuthon_medical_manage,model_yuthon_medical_manage,base.group_user,1,1,1,1
access_yuthon_medical_line,yuthon_medical_line,model_yuthon_medical_line,base.group_user,1,1,1,1
access_yuthon_medical_line,yuthon_medical_line,model_yuthon_medical_line,base.group_user,1,1,1,1
access_yuthon_salary_group,yuthon_salary_group,model_yuthon_salary_group,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
18 access_yuthon_party_setting yuthon_party_setting model_yuthon_party_setting base.group_user 1 1 1 1
19 access_yuthon_medical_rule yuthon_medical_rule model_yuthon_medical_rule base.group_user 1 1 1 1
20 access_yuthon_medical_manage yuthon_medical_manage model_yuthon_medical_manage base.group_user 1 1 1 1
21 access_yuthon_medical_line yuthon_medical_line model_yuthon_medical_line base.group_user 1 1 1 1
22 access_yuthon_salary_group yuthon_salary_group model_yuthon_salary_group base.group_user 1 1 1 1
@@ -21,6 +21,7 @@
<xpath expr="//field[@name='work_email']" position="after">
<field name="user_state"/>
<field name="yuthon_company"/>
<field name="salary_group_id"/>
</xpath>
<xpath expr="//page[@name='personal_information']" position="replace">
<page name="personal_information" string="个人隐私信息">
@@ -226,6 +227,7 @@
<xpath expr="//field[@name='job_id']" position="after">
<field name="yuthon_company" optional="hide"/>
<field name="use_user_type"/>
<field name="salary_group_id" column_invisible="1"/>
<field name="number"/>
<field name="user_number" optional="hide"/>
<field name="mobile_phone"/>
@@ -269,6 +271,14 @@
<field name="pinyin_min"/>
</xpath>
</field>
<!-- <xpath expr="//group[@string='Group By']" position="after">-->
<!-- <header_search>-->
<!-- <quick_filter string="分组">-->
<!-- <filter string="领导" name="manager" domain="[('salary_group_id.name', '=', '领导')]"/>-->
<!-- <filter string="员工" name="employee" domain="[('salary_group_id.name', '=', '员工')]"/>-->
<!-- </quick_filter>-->
<!-- </header_search>-->
<!-- </xpath>-->
</record>
<record id="all_data_write_user" model="ir.actions.server">
<field name="name">批量更新员工</field>
@@ -19,4 +19,18 @@
<field name="res_model">yuthon.party.setting</field>
<field name="view_mode">tree</field>
</record>
<record id="view_yuthon_salary_group_tree" model="ir.ui.view">
<field name="name">yuthon.salary.group.tree</field>
<field name="model">yuthon.salary.group</field>
<field name="arch" type="xml">
<tree string="工资单分组" editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="action_yuthon_salary_group" model="ir.actions.act_window">
<field name="name">工资单分组</field>
<field name="res_model">yuthon.salary.group</field>
<field name="view_mode">tree</field>
</record>
</odoo>
@@ -26,3 +26,20 @@ class InheritHrPayslip(models.Model):
if line.name == '职级工资':
rec.rank_salary = line.amount
def put_payslip(self):
menu_id = self.env['ir.ui.menu'].search([('name', '=', '工资条'), ('parent_id', '!=', False)])
str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=hr.payslip&view_type=list'.format(
self.id, menu_id.id, menu_id.action.id)
we_id = self.env['hr.employee'].search([('id', '=', self.employee_id)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='payslip', user_id=we_id, title="薪资确认",
description=self.employee_id.name + '请确认你的薪资:',
url=str, btntxt="详细信息")
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'success',
'message': '确认通知已发送',
'sticky': False,
}
}
@@ -24,6 +24,9 @@
<field name="commuting_allowance"/>
<field name="rank_salary"/>
</xpath>
<xpath expr="//field[@name='state']" position="after">
<button name="put_payslip" type="object" string="发送" class="btn-primary"/>
</xpath>
</field>
</record>
<record id="hr_payroll_inherit_form" model="ir.ui.view">
+7 -16
View File
@@ -12,7 +12,8 @@ class SalaryComputeWizard(models.Model):
_name = 'salary.compute.wizard'
_description = '薪资计算弹窗'
department_ids = fields.Many2many('hr.department', string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
string='公司')
employee_ids = fields.Many2many('hr.employee', string='人员', store=True)
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='年份',
default=lambda self: str(datetime.now().year))
@@ -26,21 +27,11 @@ class SalaryComputeWizard(models.Model):
current_month = datetime.now().month
return str(current_month)
@api.onchange('department_ids')
def onchange_employee_ids(self):
def get_department_employees(department_id):
valid_user_ids = set()
employee_ids = self.env['hr.employee'].search([('department_id', '=', department_id.id.origin)])
valid_user_ids.update([user.user_id.id for user in employee_ids if user.user_id])
child_ids = self.env['hr.department'].search([('parent_id', '=', department_id.id)])
for child in child_ids:
valid_user_ids.update(get_department_employees(child))
return valid_user_ids
department_user_ids = set()
for department_id in self.department_ids:
department_user_ids.update(get_department_employees(department_id))
self.employee_ids = [(6, 0, list(department_user_ids))]
@api.onchange('yuthon_company')
def onchange_yuthon_company(self):
if self.yuthon_company:
employees = self.env['hr.employee'].search([('yuthon_company', '=', self.yuthon_company)])
self.employee_ids = [(6, 0, employees.ids)]
def confirm(self):
for employee in self.employee_ids:
@@ -7,8 +7,8 @@
<form>
<sheet>
<group>
<field name="department_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags" force_save="1"/>
<field name="yuthon_company"/>
<field name="employee_ids" widget="many2many_tags" force_save="1" invisible="1"/>
<field name="select_year"/>
<field name="select_time"/>
</group>
+5
View File
@@ -262,6 +262,11 @@
parent="hr_setting_menu_root_board"
action="yuthon_hr_employee.action_yuthon_party_setting"
sequence="20"/>
<menuitem id="yuthon_salary_group_board"
name="工资单分组"
parent="hr_setting_menu_root_board"
action="yuthon_hr_employee.action_yuthon_salary_group"
sequence="25"/>
<!--假期管理-->
<menuitem id="holiday_manage_menu_root_board"