fix(hrms): sick leave BHXH formula /24 + base tháng liền kề (TETRA-1446) #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/TETRA-1446-sick-leave-bhxh-formula"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix 2 bug trong BHXH Claim sick-leave / work-injury formula vi phạm Luật BHXH 41/2024 Đ.45 khoản 5 (hiệu lực 01/07/2025).
Trước:
daily_rate = avg_salary_6m / 26→ NV thiếu ~8% + sai số khi đổi bậc.Sau:
daily_rate = lương_BH_tháng_liền_kề / 24(chỉ sick leave + work-injury).Maternity (
Thai san) giữ /26 + 6-month avg per Đ.39 — KHÔNG ảnh hưởng.Changes
vhrms/vhrms/doctype/bhxh_claim/bhxh_claim.py: renamecalculate_average_salary→calculate_insurance_base_salary, branch logic theo claim_type, fix divisor /24 cho sick/work-injury.vhrms/vhrms/payroll/vietnam_calculations.py: helper mớiget_previous_month_insurance_salary(employee, claim_month)với fallback chain Salary Slip → SSA → Employee.ctc.vhrms/vhrms/patches/v0_7_0/recompute_old_bhxh_claims.py: backfill patch READ-ONLY — log delta cho từng claim từ 01/07/2025, không auto-update (HR review thủ công).vhrms/patches.txt: register new patch.vhrms/vhrms/tests/test_bhxh_claim_formula.py: 10 unit tests (divisor /24, helper fallback chain, sick-leave dùng tháng liền kề, maternity regression, edge cases NV mới).vhrms/vhrms/tests/test_payroll_deductions.py: extend frappe stub vớiadd_months/get_first_day/get_last_day(dovietnam_calculations.pyimport thêm các helper này).CHANGELOG.md: entry [0.7.0].Test plan
bench migratetrên staging → patch chạy + log deltaRefs
🤖 Generated with Claude Code
31e1022732to56cf83d72cReview summary (Claude Code)
Verdict: ✅ APPROVE (after addressing nits in
56cf83d)Reviewed deeply against TETRA-1446 acceptance + Luật BHXH 41/2024 Đ.45.5. All 4 critical surfaces (divisor, base, fallback chain, maternity regression) verified via 10 unit tests. 18/18 combined payroll suite pass.
Fixes applied in
56cf83d:recompute_old_bhxh_claims.py: import canonicalget_previous_month_insurance_salarythay vì duplicate (tránh drift).vietnam_calculations.py: thêm comment intent cho Salary Slip filter (off-cycle slip behavior) + SSA fallback boundary (claim_start, không phảiprev_month_end).test_bhxh_claim_formula.py: xóa dead_mock_db_sql+ unusedSimpleNamespaceimport.Deferred (sẽ tạo follow-up tickets):
average_salarysemantic-overload — rename →benefit_base_salaryv0.8.0.