添加功能

This commit is contained in:
zhou
2025-03-21 10:32:32 +08:00
parent 8628eaacc3
commit 6ef400a9b9
2 changed files with 15 additions and 2 deletions
+13 -1
View File
@@ -41,7 +41,7 @@ class InheritHrPayslip(models.Model):
unemployment_insurance = fields.Float(string='失业保险费', compute='_compute_salary', store=True)
work_injury_insurance = fields.Float(string='工伤保险费', compute='_compute_salary', store=True)
housing_provident_fund = fields.Float(string='住房公积金', compute='_compute_salary', store=True)
total_before_tax = fields.Float(string='税前合计', compute='_compute_salary', store=True)
total_before_tax = fields.Float(string='税前合计', compute='_compute_total_before_tax', store=True)
attendance_deduction_total = fields.Float(string='考勤扣款合计')
assessment_reserved_amount = fields.Float(string='考核保留量')
@@ -132,3 +132,15 @@ class InheritHrPayslip(models.Model):
"view_mode": "form",
"target": "new",
}
@api.depends('line_ids')
def _compute_total_before_tax(self):
common_records = self.env['yuthon.payroll.common'].search([('before_tax', '=', True)])
name_list = [record.name for record in common_records]
for payslip in self:
total = 0
for line in payslip.line_ids:
if line.name in name_list:
total += line.total
payslip.total_before_tax = total
@@ -32,6 +32,7 @@
<field name="seniority_salary"/>
<field name="overtime_pay"/>
<field name="full_attendance_award"/>
<field name="total_before_tax"/>
<field name="attendance_deduction_total"/>
<field name="assessment_reserved_amount"/>
<field name="basic_endowment_insurance"/>
@@ -61,7 +62,6 @@
<field name="exam_leave"/>
<field name="parents_meeting_leave"/>
<field name="work_injury_insurance"/>
<field name="total_before_tax"/>
</xpath>
<xpath expr="//field[@name='state']" position="after">
<button name="put_payslip" type="object" string="发送" class="btn-primary"/>
@@ -114,6 +114,7 @@
</group>
<group>
<field name="tax"/>
<field name="total_before_tax"/>
<field name="full_attendance_award" invisible="1"/>
<field name="commuting_allowance" invisible="1"/>
<field name="post_salary" invisible="1"/>