'Set the task realm entity to the project\'s realm entity'

@staticmethod
def project_task_realm_entity(table, record):

    task_id = record.id
    db = current.db
    ptable = db.project_project
    ltable = db.project_task_project
    query = ((ltable.task_id == task_id) & (ltable.project_id == ptable.id))
    project = db(query).select(ptable.realm_entity, limitby=(0, 1)).first()
    if project:
        return project.realm_entity
    else:
        return None
