From 3b89b8d0a9c7ae4d3b03e3d70e838b04bb99ae0c Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 31 Mar 2025 17:02:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_salary/__manifest__.py | 4 +++ yuthon_salary/models/yuthon_payroll_labor.py | 10 ------- .../models/yuthon_payroll_retired.py | 11 +------ .../static/src/js/salary_labor_button.js | 29 +++++++++++++++++++ .../static/src/js/salary_retired_button.js | 29 +++++++++++++++++++ .../static/src/xml/salary_labor_button.xml | 10 +++++++ .../static/src/xml/salary_retired_button.xml | 11 +++++++ .../views/yuthon_payroll_labor_views.xml | 14 +++------ .../views/yuthon_payroll_retired_views.xml | 14 +++------ 9 files changed, 92 insertions(+), 40 deletions(-) create mode 100644 yuthon_salary/static/src/js/salary_labor_button.js create mode 100644 yuthon_salary/static/src/js/salary_retired_button.js create mode 100644 yuthon_salary/static/src/xml/salary_labor_button.xml create mode 100644 yuthon_salary/static/src/xml/salary_retired_button.xml diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index 83a05254c..210d21994 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -36,8 +36,12 @@ 'web.assets_backend': [ 'yuthon_salary/static/src/js/salary_create_button.js', 'yuthon_salary/static/src/js/salary_payslip_button.js', + 'yuthon_salary/static/src/js/salary_labor_button.js', 'yuthon_salary/static/src/js/salary_return_button.js', + 'yuthon_salary/static/src/js/salary_retired_button.js', 'yuthon_salary/static/src/xml/salary_create_button.xml', + 'yuthon_salary/static/src/xml/salary_labor_button.xml', + 'yuthon_salary/static/src/xml/salary_retired_button.xml', 'yuthon_salary/static/src/xml/salary_payslip_button.xml', 'yuthon_salary/static/src/xml/salary_return_button.xml', ], diff --git a/yuthon_salary/models/yuthon_payroll_labor.py b/yuthon_salary/models/yuthon_payroll_labor.py index 6b0b78c55..8f4d004c5 100644 --- a/yuthon_salary/models/yuthon_payroll_labor.py +++ b/yuthon_salary/models/yuthon_payroll_labor.py @@ -24,14 +24,4 @@ class YuthonPayrollLabor(models.Model): 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", - } - - diff --git a/yuthon_salary/models/yuthon_payroll_retired.py b/yuthon_salary/models/yuthon_payroll_retired.py index e86637ba1..eb8284bdd 100644 --- a/yuthon_salary/models/yuthon_payroll_retired.py +++ b/yuthon_salary/models/yuthon_payroll_retired.py @@ -21,13 +21,4 @@ class YuthonPayrollRetired(models.Model): ('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", - } \ No newline at end of file + retired_amount = fields.Float(string='金额') \ No newline at end of file diff --git a/yuthon_salary/static/src/js/salary_labor_button.js b/yuthon_salary/static/src/js/salary_labor_button.js new file mode 100644 index 000000000..9035fe8c5 --- /dev/null +++ b/yuthon_salary/static/src/js/salary_labor_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 CustomSalaryLaborController extends ListController { + setup() { + super.setup(); + } + + openLaborWizard() { + this.actionService.doAction({ + type: 'ir.actions.act_window', + res_model: 'payroll.labor.wizard', + name: '劳务费导入', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', // 以弹窗形式打开 + context: {}, + }); + } +} + +registry.category("views").add("custom_labor_button", { + ...listView, + Controller: CustomSalaryLaborController, + buttonTemplate: "labor_module.ListView.Buttons", +}); \ No newline at end of file diff --git a/yuthon_salary/static/src/js/salary_retired_button.js b/yuthon_salary/static/src/js/salary_retired_button.js new file mode 100644 index 000000000..618df303d --- /dev/null +++ b/yuthon_salary/static/src/js/salary_retired_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 CustomSalaryRetiredController extends ListController { + setup() { + super.setup(); + } + + openRetiredWizard() { + this.actionService.doAction({ + type: 'ir.actions.act_window', + res_model: 'payroll.retired.wizard', + name: '退休人员费用导入', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', // 以弹窗形式打开 + context: {}, + }); + } +} + +registry.category("views").add("custom_retired_button", { + ...listView, + Controller: CustomSalaryRetiredController, + buttonTemplate: "retired_module.ListView.Buttons", +}); \ No newline at end of file diff --git a/yuthon_salary/static/src/xml/salary_labor_button.xml b/yuthon_salary/static/src/xml/salary_labor_button.xml new file mode 100644 index 000000000..1d44c031f --- /dev/null +++ b/yuthon_salary/static/src/xml/salary_labor_button.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/yuthon_salary/static/src/xml/salary_retired_button.xml b/yuthon_salary/static/src/xml/salary_retired_button.xml new file mode 100644 index 000000000..e0d1b11b8 --- /dev/null +++ b/yuthon_salary/static/src/xml/salary_retired_button.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/yuthon_salary/views/yuthon_payroll_labor_views.xml b/yuthon_salary/views/yuthon_payroll_labor_views.xml index a414bc6ca..44497f6c2 100644 --- a/yuthon_salary/views/yuthon_payroll_labor_views.xml +++ b/yuthon_salary/views/yuthon_payroll_labor_views.xml @@ -4,10 +4,10 @@ yuthon.payroll.labor.tree yuthon.payroll.labor - + - - + + @@ -29,13 +29,7 @@ 劳务费 yuthon.payroll.labor tree,form - - - 导入劳务费用 - - - code - action = model.action_payroll_labor_wizard() + {'search_default_group_by_current_year_id': 1, 'search_default_group_by_current_month': 1} diff --git a/yuthon_salary/views/yuthon_payroll_retired_views.xml b/yuthon_salary/views/yuthon_payroll_retired_views.xml index 70608ee24..6ccd5cb46 100644 --- a/yuthon_salary/views/yuthon_payroll_retired_views.xml +++ b/yuthon_salary/views/yuthon_payroll_retired_views.xml @@ -4,10 +4,10 @@ yuthon.payroll.retired.tree yuthon.payroll.retired - + - - + + @@ -29,13 +29,7 @@ 退休人员费用 yuthon.payroll.retired tree,form - - - 导入退休人员费用 - - - code - action = model.action_payroll_retired_wizard() + {'search_default_group_by_current_year_id': 1, 'search_default_group_by_current_month': 1}