fix(setup): salary structure là template chung + sửa Thuế TNCN conflict + re-raise #150

Merged
tant merged 1 commit from feat/TETRA-1974-salary-structure-global into develop 2026-06-02 08:04:47 +07:00
Owner

Vấn đề

bench install-app vhrms tạo 0 Salary Structure dù install báo thành công — _build_salary_structure submit() throw ValidationError: Cannot set amount or formula for Salary Component Thuế TNCN with Variable Based On Taxable Salary, bị except nuốt (log rồi return). Chặn seed demo + payroll.

Sửa

  1. Bỏ formula/amount_based_on_formula ở deduction row Thuế TNCN (component có variable_based_on_taxable_salary=1 → PIT tính qua Income Tax Slab, Frappe cấm kèm formula).
  2. Chuyển create_standard_salary_structures() từ _first_company_seed()_global_setup(): salary structure chuẩn là template chung company-independent, luôn cần sau install/migrate.
  3. _build_salary_structure: company=None → structure global, không bind công ty.
  4. _build_salary_structure re-raise sau log (không nuốt) → install fail to, tránh false-success.

Verified: create_standard_salary_structures() tạo đủ 2 structure (Lương Chính thức / Lương Thử việc) không lỗi.

Refs: TETRA-1974, TETRA-1975

## Vấn đề `bench install-app vhrms` tạo 0 Salary Structure dù install báo thành công — `_build_salary_structure` submit() throw `ValidationError: Cannot set amount or formula for Salary Component Thuế TNCN with Variable Based On Taxable Salary`, bị `except` nuốt (log rồi return). Chặn seed demo + payroll. ## Sửa 1. Bỏ `formula`/`amount_based_on_formula` ở deduction row **Thuế TNCN** (component có `variable_based_on_taxable_salary=1` → PIT tính qua Income Tax Slab, Frappe cấm kèm formula). 2. Chuyển `create_standard_salary_structures()` từ `_first_company_seed()` → `_global_setup()`: salary structure chuẩn là **template chung company-independent**, luôn cần sau install/migrate. 3. `_build_salary_structure`: `company=None` → structure global, không bind công ty. 4. `_build_salary_structure` **re-raise** sau log (không nuốt) → install fail to, tránh false-success. Verified: `create_standard_salary_structures()` tạo đủ 2 structure (Lương Chính thức / Lương Thử việc) không lỗi. Refs: TETRA-1974, TETRA-1975
- Chuyển create_standard_salary_structures() từ _first_company_seed() sang
  _global_setup(): salary structure 'Lương Chính thức'/'Lương Thử việc' là
  template chung company-independent, luôn cần tồn tại sau install/migrate.
- _build_salary_structure: company optional (=None) → tạo structure global,
  không bind công ty nào. Account resolve theo Company của SSA lúc tính Salary Slip.
- Bỏ formula/amount_based_on_formula ở deduction row 'Thuế TNCN' — component có
  variable_based_on_taxable_salary=1, Frappe cấm kết hợp với formula → trước đây
  insert salary structure throw ValidationError.
- _build_salary_structure không nuốt exception: log + re-raise để install/migrate
  fail to, tránh false-success (site thiếu cơ cấu lương mà không ai biết).

Refs: TETRA-1974, TETRA-1975
tant merged commit e8d0eab05d into develop 2026-06-02 08:04:47 +07:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tant/vhrms!150
No description provided.