Merge pull request !2710 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-05-12 10:03:00 +00:00
committed by Gitee
3 changed files with 23 additions and 5 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class InheritHrPayslip(models.Model):
salary_state = fields.Selection([('to_signed', '待签字' ), ('to_release', '待发放'), ('released', '已发放')], string='状态', default='to_signed')
commercial_health_insurance = fields.Float(string='商业健康保险')
tax_deferred_pension_insurance = fields.Float(string='税延养老保险')
others = fields.Float(string='其他')
others = fields.Float(string='其他扣除')
deductible_donations = fields.Float(string='准予扣除的捐赠额')
total_pre_tax_deductions = fields.Float(string='税前扣除项目合计')
tax_reduction = fields.Float(string='减免税额')
+12 -4
View File
@@ -83,9 +83,13 @@ class SalaryPayslipWizard(models.Model):
current_year = datetime.now().year
payslip_run_name = f'{current_year}年-{int(self.select_time)}月'
month = int(self.select_time)
month_mapping = {
1: '一月', 2: '二月', 3: '三月', 4: '四月',
5: '五月', 6: '六月', 7: '七月', 8: '八月',
9: '九月', 10: '十月', 11: '十一月', 12: '十二月'
}
month_name = month_mapping.get(month, '一月')
payslip_run_id = self.env['hr.payslip.run'].search([('name', '=', payslip_run_name)])
date_from = datetime(current_year, month, 1).strftime('%Y-%m-%d')
last_day = (datetime(current_year, month % 12 + 1, 1) - timedelta(days=1)).strftime('%Y-%m-%d')
if not payslip_run_id:
payslip_run_id = self.env['hr.payslip.run'].create({
'name': payslip_run_name,
@@ -94,8 +98,12 @@ class SalaryPayslipWizard(models.Model):
'state': 'draft',
'payslip_count': 0
})
payslip_id = self.env['hr.payslip'].search([('employee_id', '=', employee_id.id), ('is_push', '=', True), ('is_salary_push', '=', False),
('date_from', '>=', date_from), ('date_to', '<=', last_day)])
payslip_id = self.env['hr.payslip'].search([
('employee_id', '=', employee_id.id),
('is_push', '=', True),
('is_salary_push', '=', False),
('payslip_run_id.name', 'like', f'%年-{month_name}') # 匹配格式:"2025年-一月"
])
payslip_id.write({
'deduction_standard': row[20].value,
'specialized_deduction': row[21].value,
@@ -82,6 +82,11 @@
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user" options="{'post_refresh': 'recipients'}"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
@@ -154,6 +159,11 @@
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user" options="{'post_refresh': 'recipients'}"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>