添加功能

This commit is contained in:
zhou
2025-07-30 16:29:12 +08:00
parent 26a24cdd7f
commit 8c13170394
4 changed files with 18 additions and 14 deletions
@@ -20,6 +20,18 @@ export class CustomSalaryStatementsController extends ListController {
context: {},
});
}
openPensionWizard(){
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'basic.pension.wizard',
name: '社保导入',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new', // 以弹窗形式打开
context: {},
});
}
}
registry.category("views").add("custom_salary_button", {
@@ -6,5 +6,10 @@
薪资计算
</button>
</xpath>
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openPensionWizard">
社保导入
</button>
</xpath>
</t>
</templates>
@@ -788,13 +788,6 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_salary.my_hr_payslip_view_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('hr_payroll.view_hr_payslip_form')})]"/>
</record>
<record id="all_basic_pension_wizard" model="ir.actions.server">
<field name="name">五险一金导入弹窗</field>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="binding_model_id" ref="hr_payroll.model_hr_payslip"/>
<field name="state">code</field>
<field name="code">action = model.basic_pension_wizard()</field>
</record>
<record id="all_data_return_salary" model="ir.actions.server">
<field name="name">批量退回个税计算</field>
<field name="model_id" ref="hr_payroll.model_hr_payslip"/>
@@ -67,13 +67,11 @@ class TemporaryPayslipWizard(models.Model):
'个税扣发(减)',
'年金差额(减)',
'扣发绩效奖金',
'三险一金',
'企业(职业)年金',
'应补(退)税额',
'工会会费',
'补扣保险',
]
processed_value = float(cell_value)
if header in negative_items:
processed_value = -abs(processed_value)
@@ -86,11 +84,7 @@ class TemporaryPayslipWizard(models.Model):
payslip.write({field_name: float(processed_value)})
if header not in existing_line_names and header not in field_mapping:
raise ValidationError(
f'未识别到存在工资项,请检查是否有该项目和格式名称是否对应\n'
f'员工: {employee_id.name}\n批次: {self.select_year}年-{month_name}\n'
f'薪资结构: {payslip.struct_id.name}\n导入工资项名称: {header}'
)
pass
match_header = header
if header == '企业(职业)年金':
match_header = '企业(职业)年金'