diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index 25c4a1389..66bcfc879 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -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, } diff --git a/yuthon_salary/static/src/js/salary_create_button.js b/yuthon_salary/static/src/js/salary_create_button.js new file mode 100644 index 000000000..04f890deb --- /dev/null +++ b/yuthon_salary/static/src/js/salary_create_button.js @@ -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", +}); \ No newline at end of file diff --git a/yuthon_salary/static/src/xml/salary_create_button.xml b/yuthon_salary/static/src/xml/salary_create_button.xml new file mode 100644 index 000000000..88123c2b9 --- /dev/null +++ b/yuthon_salary/static/src/xml/salary_create_button.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 5c454f8a0..29a7df932 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -5,6 +5,9 @@ hr.payslip + + custom_salary_button +