Job Position
Each CollectiveAgreement can have multiple job positions, that are linked inside Business Central as "FunctieCao" records.
Model
Bases: LifecycleModelMixin, Model
Source code in backend/jobs/models.py
| class JobPosition(LifecycleModelMixin, models.Model):
collective_agreement = models.ForeignKey(
"location_projects.CollectiveAgreement", on_delete=models.SET_NULL, null=True
)
salesforce_ref = models.CharField(max_length=18, null=False, blank=False)
name = models.CharField(max_length=255, null=False, blank=False)
code = models.CharField(max_length=100, blank=True, help_text="Used for integration with Business Central")
class Meta:
ordering = ["-pk"]
verbose_name = "job_position"
verbose_name_plural = "Jobs Positions"
db_table = "job_positions"
indexes = [
models.Index(fields=["name"]),
models.Index(fields=["salesforce_ref"]),
]
def __str__(self):
return self.name
@property
def is_in_salesforce(self) -> bool:
"""Check if the company is in Salesforce."""
return bool(self.salesforce_ref)
@hook(AFTER_CREATE)
def schedule_wage_population(self):
"""
Enqueue async wage population for new positions.
"""
fetch_position_wages.delay(self.pk)
|
is_in_salesforce
property
Check if the company is in Salesforce.
schedule_wage_population()
Enqueue async wage population for new positions.
Source code in backend/jobs/models.py
| @hook(AFTER_CREATE)
def schedule_wage_population(self):
"""
Enqueue async wage population for new positions.
"""
fetch_position_wages.delay(self.pk)
|