Merge pull request !2222 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-03-31 09:03:06 +00:00
committed by Gitee
9 changed files with 92 additions and 40 deletions
+4
View File
@@ -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',
],
@@ -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",
}
+1 -10
View File
@@ -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",
}
retired_amount = fields.Float(string='金额')
@@ -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",
});
@@ -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",
});
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="labor_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="openLaborWizard">
劳务费导入
</button>
</xpath>
</t>
</templates>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>
<t t-name="retired_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="openRetiredWizard">
退休费用导入
</button>
</xpath>
</t>
</templates>
@@ -4,10 +4,10 @@
<field name="name">yuthon.payroll.labor.tree</field>
<field name="model">yuthon.payroll.labor</field>
<field name="arch" type="xml">
<tree string="劳务费" editable="bottom">
<tree string="劳务费" editable="bottom" js_class="custom_labor_button">
<field name="employee_id" domain="[('use_user_type', '=', 'labor')]"/>
<field name="current_year"/>
<field name="current_month"/>
<field name="current_year" optional="hide"/>
<field name="current_month" optional="hide"/>
<field name="labor_amount"/>
</tree>
</field>
@@ -29,13 +29,7 @@
<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>
<field name="context">{'search_default_group_by_current_year_id': 1, 'search_default_group_by_current_month': 1}</field>
</record>
</odoo>
@@ -4,10 +4,10 @@
<field name="name">yuthon.payroll.retired.tree</field>
<field name="model">yuthon.payroll.retired</field>
<field name="arch" type="xml">
<tree string="退休人员费用" editable="bottom">
<tree string="退休人员费用" editable="bottom" js_class="custom_retired_button">
<field name="name"/>
<field name="current_year"/>
<field name="current_month"/>
<field name="current_year" optional="hide"/>
<field name="current_month" optional="hide"/>
<field name="retired_amount"/>
</tree>
</field>
@@ -29,13 +29,7 @@
<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>
<field name="context">{'search_default_group_by_current_year_id': 1, 'search_default_group_by_current_month': 1}</field>
</record>
</odoo>