From 31ee9e2e3cbe09d7dd88a0fdb3ed10ccb7d21ab9 Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Sat, 16 May 2026 22:20:46 +0200 Subject: [PATCH] feat: type=Salary auto-scopes Add-Adjustment picker to managers When type=Salary: set pay-type filter to Managers-only, hide daily rows, and untick any selected daily worker so a Salary can never silently target a daily worker. Re-applied on the Pay-Salary open path (the show.bs.modal reset clears it first). Pure JS; verified by manual checklist; suite stays 207/207. Co-Authored-By: Claude Opus 4.7 (1M context) --- core/templates/core/payroll_dashboard.html | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/core/templates/core/payroll_dashboard.html b/core/templates/core/payroll_dashboard.html index 57c5ec2..666887d 100644 --- a/core/templates/core/payroll_dashboard.html +++ b/core/templates/core/payroll_dashboard.html @@ -1948,6 +1948,41 @@ document.addEventListener('DOMContentLoaded', function() { addAdjPayImmediatelyGroup.style.display = (payNowTypes.indexOf(addAdjType.value) !== -1) ? '' : 'none'; } + // === Salary → managers-only picker scope === + // Salary is a managers-only adjustment (Worker.pay_type='fixed'). + // To make it IMPOSSIBLE to accidentally pay a Salary to a daily + // worker, when the type is Salary we: (1) set the pay-type + // filter to "Managers only", (2) hide every non-manager row, + // and (3) UNTICK any non-manager that was already selected so a + // stray daily-worker tick can't ride along hidden into a bad + // Salary adjustment. For any other type we reset the filter to + // "All" and re-show every row (we do NOT re-tick anything — the + // user re-selects deliberately). Re-grab the filter