添加功能

This commit is contained in:
zhou
2025-03-07 10:34:51 +08:00
parent 3fc328e6b5
commit 39b0dbe524
4 changed files with 48 additions and 0 deletions
+6
View File
@@ -23,6 +23,12 @@
'wizard/yuthon_salary_wizard_views.xml',
'wizard/yuthon_payroll_wizard_views.xml',
],
'assets': {
'web.assets_backend': [
'yuthon_salary/static/src/js/salary_create_button.js',
'yuthon_salary/static/src/xml/salary_create_button.xml',
],
},
'installable': True,
'application': True,
}
@@ -0,0 +1,29 @@
/** @odoo-module */
import { ListController } from "@web/views/list/list_controller";
import { registry } from '@web/core/registry';
import { listView } from '@web/views/list/list_view';
export class CustomSalaryStatementsController extends ListController {
setup() {
super.setup();
}
openSalaryWizard() {
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'yuthon.salary.wizard',
name: '薪资计算',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new', // 以弹窗形式打开
context: {},
});
}
}
registry.category("views").add("custom_salary_button", {
...listView,
Controller: CustomSalaryStatementsController,
buttonTemplate: "salary_module.ListView.Buttons",
});
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="salary_module.ListView.Buttons" t-inherit="web.ListView.Buttons">
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openSalaryWizard">
薪资计算
</button>
</xpath>
</t>
</templates>
@@ -5,6 +5,9 @@
<field name="model">hr.payslip</field>
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="js_class">custom_salary_button</attribute>
</xpath>
<xpath expr="//field[@name='net_wage']" position="after">
<field name="base_salary"/>
<field name="performance_bonuses"/>