feat: register 'Salary' PayrollAdjustment type as additive

This commit is contained in:
Konrad du Plessis 2026-05-15 19:20:04 +02:00
parent 3c471691f3
commit b3a8147a60
3 changed files with 15 additions and 1 deletions

View File

@ -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')

View File

@ -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)

View File

@ -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']