def all_reports(self, override=False): if not ForemanOptions.get_options().manager_inherit and not override: return self.direct_reports else: reports = [] for direct_report in self.direct_reports: reports.append(direct_report) reports.extend(direct_report.all_reports()) return reports
def is_manager_of(self, user): man = user.manager if man is None: return False if man.id == self.id: return True if not ForemanOptions.get_options().manager_inherit: return False else: return self.is_manager_of(man)
def __init__(self, case_name, user, background=None, reference=None, private=False, location=None, classification=None, case_type=None, justification=None): self.case_name = case_name self.reference = reference self.set_status(CaseStatus.CREATED, user) self.private = private self.background = background self.classification = classification self.case_type = case_type self.justification = justification if location is None: self.location = ForemanOptions.get_default_location() else: self.location = location self.creation_date = datetime.now()
def date(self): return ForemanOptions.get_date(self.date_time)
def date_created(self): return ForemanOptions.get_date(self.creation_date)
def deleted_date(self): return ForemanOptions.get_date(self.date_deleted)
def date(self): return ForemanOptions.get_date(self.date_added)
def custody_date(self): return ForemanOptions.get_date(self.date_of_custody)