Update Employee functionalities: display contract/project name in dashboard

This commit is contained in:
Nguyen Ngo
2025-09-19 12:05:30 -04:00
parent 8a0f4e8f4b
commit 762e477ba1
4 changed files with 17 additions and 8 deletions
+10 -1
View File
@@ -69,4 +69,13 @@ class Employee(base.db.Model):
'title': self.title,
'display_title': self.display_title,
'contractId': self.contractId
}
}
project = base.db.relationship('Project', foreign_keys=[contractId],
primaryjoin="Employee.contractId == Project.id",
backref='employees')
@property
def contract_name(self):
"""Get project name from contractId"""
return self.project.name if self.project else f"Contract {self.contractId}"