添加功能

This commit is contained in:
zhou
2025-03-31 16:18:04 +08:00
parent 4ea39d87bb
commit 1adb2d14a7
14 changed files with 307 additions and 4 deletions
+4
View File
@@ -20,9 +20,13 @@
'views/yuthon_payroll_project_views.xml',
'views/yuthon_payroll_board_views.xml',
'views/yuthon_payroll_type_setting_views.xml',
'views/yuthon_payroll_labor_views.xml',
'views/yuthon_payroll_retired_views.xml',
'wizard/yuthon_salary_wizard_views.xml',
'wizard/temporary_payslip_wizard_views.xml',
'wizard/yuthon_payroll_wizard_views.xml',
'wizard/payroll_labor_wizard_views.xml',
'wizard/payroll_retired_wizard_views.xml',
'wizard/salary_compute_wizard_views.xml',
'wizard/salary_payslip_wizard_views.xml',
'wizard/select_delete_wizard_viwes.xml',
+3 -1
View File
@@ -4,4 +4,6 @@ from . import inherit_hr_payroll_structure_type
from . import inherit_hr_payslip
from . import yuthon_payroll_type_setting
from . import yuthon_payroll_project
from . import yuthon_payroll_board
from . import yuthon_payroll_board
from . import yuthon_payroll_labor
from . import yuthon_payroll_retired
@@ -0,0 +1,37 @@
from odoo import api, fields, models
class YuthonPayrollLabor(models.Model):
_name = 'yuthon.payroll.labor'
_description = '劳务费'
employee_id = fields.Many2one('hr.employee', string='姓名')
current_year = fields.Integer(string='年份')
current_month = fields.Selection([
('1', '1月份'),
('2', '2月份'),
('3', '3月份'),
('4', '4月份'),
('5', '5月份'),
('6', '6月份'),
('7', '7月份'),
('8', '8月份'),
('9', '9月份'),
('10', '10月份'),
('11', '11月份'),
('12', '12月份')
], string="月份")
labor_amount = fields.Float(string='金额')
def action_payroll_labor_wizard(self):
return {
"type": "ir.actions.act_window",
"name": "劳务费导入",
"res_model": "payroll.labor.wizard",
"view_mode": "form",
"target": "new",
}
@@ -0,0 +1,33 @@
from odoo import api, fields, models
class YuthonPayrollRetired(models.Model):
_name = 'yuthon.payroll.retired'
_description = '退休人员费用'
name = fields.Char(string='姓名')
current_year = fields.Integer(string='年份')
current_month = fields.Selection([
('1', '1月份'),
('2', '2月份'),
('3', '3月份'),
('4', '4月份'),
('5', '5月份'),
('6', '6月份'),
('7', '7月份'),
('8', '8月份'),
('9', '9月份'),
('10', '10月份'),
('11', '11月份'),
('12', '12月份')
], string="月份")
retired_amount = fields.Float(string='金额')
def action_payroll_retired_wizard(self):
return {
"type": "ir.actions.act_window",
"name": "退休人员费用",
"res_model": "payroll.retired.wizard",
"view_mode": "form",
"target": "new",
}
+5 -1
View File
@@ -14,4 +14,8 @@ access_return_wizard,access_return_wizard,model_return_wizard,base.group_user,1,
access_return_salary_wizard, access_return_salary_wizard,model_return_salary_wizard,base.group_user,1,1,1,1
access_put_salary_wizard,access_put_salary_wizard,model_put_salary_wizard,base.group_user,1,1,1,1
access_yuthon_payroll_board,access_yuthon_payroll_board,model_yuthon_payroll_board,base.group_user,1,1,1,1
access_temporary_payslip_wizard,access_temporary_payslip_wizard,model_temporary_payslip_wizard,base.group_user,1,1,1,1
access_temporary_payslip_wizard,access_temporary_payslip_wizard,model_temporary_payslip_wizard,base.group_user,1,1,1,1
access_yuthon_payroll_labor,access_yuthon_payroll_labor,model_yuthon_payroll_labor,base.group_user,1,1,1,1
access_yuthon_payroll_retired,access_yuthon_payroll_retired,model_yuthon_payroll_retired,base.group_user,1,1,1,1
access_payroll_labor_wizard,access_payroll_labor_wizard,model_payroll_labor_wizard,base.group_user,1,1,1,1
access_payroll_retired_wizard,access_payroll_retired_wizard,model_payroll_retired_wizard,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
14 access_return_salary_wizard access_return_salary_wizard model_return_salary_wizard base.group_user 1 1 1 1
15 access_put_salary_wizard access_put_salary_wizard model_put_salary_wizard base.group_user 1 1 1 1
16 access_yuthon_payroll_board access_yuthon_payroll_board model_yuthon_payroll_board base.group_user 1 1 1 1
17 access_temporary_payslip_wizard access_temporary_payslip_wizard model_temporary_payslip_wizard base.group_user 1 1 1 1
18 access_yuthon_payroll_labor access_yuthon_payroll_labor model_yuthon_payroll_labor base.group_user 1 1 1 1
19 access_yuthon_payroll_retired access_yuthon_payroll_retired model_yuthon_payroll_retired base.group_user 1 1 1 1
20 access_payroll_labor_wizard access_payroll_labor_wizard model_payroll_labor_wizard base.group_user 1 1 1 1
21 access_payroll_retired_wizard access_payroll_retired_wizard model_payroll_retired_wizard base.group_user 1 1 1 1
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_yuthon_payroll_labor_tree" model="ir.ui.view">
<field name="name">yuthon.payroll.labor.tree</field>
<field name="model">yuthon.payroll.labor</field>
<field name="arch" type="xml">
<tree string="劳务费" editable="bottom">
<field name="employee_id"/>
<field name="current_year"/>
<field name="current_month"/>
<field name="labor_amount"/>
</tree>
</field>
</record>
<record id="view_yuthon_payroll_labor_search" model="ir.ui.view">
<field name="name">yuthon.payroll.labor.search</field>
<field name="model">yuthon.payroll.labor</field>
<field name="arch" type="xml">
<search string="劳务费">
<field name="employee_id"/>
<group expand="0" string="Group By">
<filter name="group_by_current_year_id" string="年份" context="{'group_by':'current_year'}"/>
<filter name="group_by_current_month" string="月份" context="{'group_by':'current_month'}"/>
</group>
</search>
</field>
</record>
<record id="action_yuthon_payroll_labor" model="ir.actions.act_window">
<field name="name">劳务费</field>
<field name="res_model">yuthon.payroll.labor</field>
<field name="view_mode">tree,form</field>
</record>
<record id="all_data_payroll_labor" model="ir.actions.server">
<field name="name">导入劳务费用</field>
<field name="model_id" ref="yuthon_salary.model_yuthon_payroll_labor"/>
<field name="binding_model_id" ref="yuthon_salary.model_yuthon_payroll_labor"/>
<field name="state">code</field>
<field name="code">action = model.action_payroll_labor_wizard()</field>
</record>
</odoo>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_yuthon_payroll_retired_tree" model="ir.ui.view">
<field name="name">yuthon.payroll.retired.tree</field>
<field name="model">yuthon.payroll.retired</field>
<field name="arch" type="xml">
<tree string="退休人员费用" editable="bottom">
<field name="name"/>
<field name="current_year"/>
<field name="current_month"/>
<field name="retired_amount"/>
</tree>
</field>
</record>
<record id="view_yuthon_payroll_retired_search" model="ir.ui.view">
<field name="name">yuthon.payroll.retired.search</field>
<field name="model">yuthon.payroll.retired</field>
<field name="arch" type="xml">
<search string="退休人员费用">
<field name="name"/>
<group expand="0" string="Group By">
<filter name="group_by_current_year_id" string="年份" context="{'group_by':'current_year'}"/>
<filter name="group_by_current_month" string="月份" context="{'group_by':'current_month'}"/>
</group>
</search>
</field>
</record>
<record id="action_yuthon_payroll_retired" model="ir.actions.act_window">
<field name="name">退休人员费用</field>
<field name="res_model">yuthon.payroll.retired</field>
<field name="view_mode">tree,form</field>
</record>
<record id="all_data_payroll_retired" model="ir.actions.server">
<field name="name">导入退休人员费用</field>
<field name="model_id" ref="yuthon_salary.model_yuthon_payroll_retired"/>
<field name="binding_model_id" ref="yuthon_salary.model_yuthon_payroll_retired"/>
<field name="state">code</field>
<field name="code">action = model.action_payroll_retired_wizard()</field>
</record>
</odoo>
+3 -1
View File
@@ -4,4 +4,6 @@ from . import salary_compute_wizard
from . import salary_payslip_wizard
from . import select_delete_wizard
from . import put_return_wizard
from . import temporary_payslip_wizard
from . import temporary_payslip_wizard
from . import payroll_labor_wizard
from . import payroll_retired_wizard
@@ -0,0 +1,25 @@
# -*- 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 PayrollLaborWizard(models.Model):
_name = 'payroll.labor.wizard'
_description = '劳务费导入弹窗'
excel_file = fields.Binary(string="上传Excel表")
excel_name = fields.Char(string="文件名")
def confirm(self):
if not self.excel_file:
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):
row = sh.row(rx)
self.yuthon_payroll_data(row)
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="labor_template_downloads_tian_he_action" model="ir.actions.act_url">
<field name="name">劳务费</field>
<field name="target">self</field>
<field name="url">.</field>
<!-- <field name="url">/yuthon_salary/static/others/payslip_labor_template.xlsx</field>-->
</record>
<record id="payslip_labor_wizard_form" model="ir.ui.view">
<field name="name">审批意见弹窗</field>
<field name="model">payroll.labor.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<header>
<button name="%(labor_template_downloads_tian_he_action)d" string="模板下载" type="action"
class="btn btn-primary"/>
</header>
<group>
<group>
<field name="excel_file" filename="excel_name"/>
<field name="excel_name" invisible="1"/>
</group>
<group>
</group>
</group>
</sheet>
<footer>
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
<button string="返回" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>
@@ -0,0 +1,26 @@
# -*- 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 PayrollLaborWizard(models.Model):
_name = 'payroll.retired.wizard'
_description = '退休人员费用导入弹窗'
excel_file = fields.Binary(string="上传Excel表")
excel_name = fields.Char(string="文件名")
def confirm(self):
if not self.excel_file:
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):
row = sh.row(rx)
self.yuthon_payroll_data(row)
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="retired_template_downloads_tian_he_action" model="ir.actions.act_url">
<field name="name">退休人员导入模板</field>
<field name="target">self</field>
<field name="url">.</field>
<!-- <field name="url">/yuthon_salary/static/others/payslip_retired_template.xlsx</field>-->
</record>
<record id="payslip_retired_wizard_form" model="ir.ui.view">
<field name="name">审批意见弹窗</field>
<field name="model">payroll.retired.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<header>
<button name="%(retired_template_downloads_tian_he_action)d" string="模板下载" type="action"
class="btn btn-primary"/>
</header>
<group>
<group>
<field name="excel_file" filename="excel_name"/>
<field name="excel_name" invisible="1"/>
</group>
<group>
</group>
</group>
</sheet>
<footer>
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
<button string="返回" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>
@@ -32,7 +32,11 @@ class SalaryComputeWizard(models.Model):
@api.onchange('yuthon_company')
def onchange_yuthon_company(self):
if self.yuthon_company:
employees = self.env['hr.employee'].search([('yuthon_company', '=', self.yuthon_company),('is_salary', '=', True)])
employees = self.env['hr.employee'].search([
('yuthon_company', '=', self.yuthon_company),
('is_salary', '=', True),
('use_user_type', '!=', 'labor')
])
self.employee_ids = [(6, 0, employees.ids)]
self.employee_number = len(self.employee_ids)
+10
View File
@@ -330,6 +330,16 @@
parent="human_resources_salary_root_board"
action="yuthon_salary.action_view_hr_payslip_month_form2"
sequence="3"/>
<menuitem id="yuthon_payroll_labor_board"
name="劳务费"
parent="human_resources_salary_root_board"
action="yuthon_salary.action_yuthon_payroll_labor"
sequence="4"/>
<menuitem id="yuthon_payroll_retired_board"
name="退休人员费用"
parent="human_resources_salary_root_board"
action="yuthon_salary.action_yuthon_payroll_retired"
sequence="5"/>
<menuitem id="human_pay_slips_root_board"
name="工资确认"
parent="human_resources_salary_root_board"