diff --git a/core/models.py b/core/models.py index 78f468d..7d2db7b 100644 --- a/core/models.py +++ b/core/models.py @@ -315,6 +315,7 @@ class PayrollAdjustment(models.Model): ('New Loan', 'Loan'), ('Advance Payment', 'Advance'), ('Advance Repayment', 'Advance Repaid'), + ('Salary', 'Salary'), ] worker = models.ForeignKey(Worker, on_delete=models.CASCADE, related_name='adjustments') diff --git a/core/tests.py b/core/tests.py index 2c013fa..3a36e46 100644 --- a/core/tests.py +++ b/core/tests.py @@ -3383,3 +3383,15 @@ class ManagerSalariedPayModelTests(TestCase): ) self.assertEqual(m.pay_type, 'fixed') self.assertTrue(m.is_salaried) + + +# === MANAGER / SALARIED PAY - 'Salary' adjustment type registration === +class ManagerSalariedPayTypeRegistrationTests(TestCase): + def test_salary_is_a_valid_adjustment_type(self): + from core.models import PayrollAdjustment + type_values = [c[0] for c in PayrollAdjustment.TYPE_CHOICES] + self.assertIn('Salary', type_values) + + def test_salary_is_additive(self): + from core.views import ADDITIVE_TYPES + self.assertIn('Salary', ADDITIVE_TYPES) diff --git a/core/views.py b/core/views.py index cb8e768..3402337 100644 --- a/core/views.py +++ b/core/views.py @@ -48,7 +48,8 @@ from .site_report_schema import COUNT_METRICS, CHECK_METRICS, label_for # These define which adjustment types ADD to a worker's pay vs SUBTRACT from it. # "New Loan" and "Advance Payment" are additive — the worker receives money upfront. # "Loan Repayment" and "Advance Repayment" are deductive — they reduce net pay. -ADDITIVE_TYPES = ['Bonus', 'Overtime', 'New Loan', 'Advance Payment'] +# 'Salary' = manager / fixed-salary monthly pay (additive). +ADDITIVE_TYPES = ['Bonus', 'Overtime', 'New Loan', 'Advance Payment', 'Salary'] DEDUCTIVE_TYPES = ['Deduction', 'Loan Repayment', 'Advance Repayment']