Update Employee functionalities: display contract/project name in dashboard
This commit is contained in:
+10
-1
@@ -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}"
|
||||
Reference in New Issue
Block a user