Skip to content

Options

hypha.apply.todo.options

SUBMISSION_DRAFT module-attribute

SUBMISSION_DRAFT = 'submission_draft'

DETERMINATION_DRAFT module-attribute

DETERMINATION_DRAFT = 'determination_draft'

REVIEW_DRAFT module-attribute

REVIEW_DRAFT = 'review_draft'

PROJECT_WAITING_PAF module-attribute

PROJECT_WAITING_PAF = 'project_waiting_paf'

PROJECT_SUBMIT_PAF module-attribute

PROJECT_SUBMIT_PAF = 'project_submit_paf'

PAF_REQUIRED_CHANGES module-attribute

PAF_REQUIRED_CHANGES = 'paf_required_changes'

PAF_WAITING_ASSIGNEE module-attribute

PAF_WAITING_ASSIGNEE = 'paf_waiting_assignee'

PAF_WAITING_APPROVAL module-attribute

PAF_WAITING_APPROVAL = 'paf_waiting_approval'

PROJECT_WAITING_CONTRACT module-attribute

PROJECT_WAITING_CONTRACT = 'project_waiting_contract'

PROJECT_WAITING_CONTRACT_DOCUMENT module-attribute

PROJECT_WAITING_CONTRACT_DOCUMENT = 'project_waiting_contract_document'

PROJECT_WAITING_CONTRACT_REVIEW module-attribute

PROJECT_WAITING_CONTRACT_REVIEW = 'project_waiting_contract_review'

PROJECT_WAITING_INVOICE module-attribute

PROJECT_WAITING_INVOICE = 'project_waiting_invoice'

INVOICE_REQUIRED_CHANGES module-attribute

INVOICE_REQUIRED_CHANGES = 'invoice_required_changes'

INVOICE_WAITING_APPROVAL module-attribute

INVOICE_WAITING_APPROVAL = 'invoice_waiting_approval'

INVOICE_WAITING_PAID module-attribute

INVOICE_WAITING_PAID = 'invoice_waiting_paid'

REPORT_DUE module-attribute

REPORT_DUE = 'report_due'

COMMENT_TASK module-attribute

COMMENT_TASK = 'comment_task'

TASKS_CODE_CHOICES module-attribute

TASKS_CODE_CHOICES = ((COMMENT_TASK, 'Comment Task'), (SUBMISSION_DRAFT, 'Submission Draft'), (DETERMINATION_DRAFT, 'Determination draft'), (REVIEW_DRAFT, 'Review Draft'), (PROJECT_WAITING_PAF, 'Project waiting project form'), (PROJECT_SUBMIT_PAF, 'Project submit project form'), (PAF_REQUIRED_CHANGES, 'Project form required changes'), (PAF_WAITING_ASSIGNEE, 'Project form waiting assignee'), (PAF_WAITING_APPROVAL, 'Project form waiting approval'), (PROJECT_WAITING_CONTRACT, 'Project waiting contract'), (PROJECT_WAITING_CONTRACT_DOCUMENT, 'Project waiting contract document'), (PROJECT_WAITING_CONTRACT_REVIEW, 'Project waiting contract review'), (PROJECT_WAITING_INVOICE, 'Project waiting invoice'), (INVOICE_REQUIRED_CHANGES, 'Invoice required changes'), (INVOICE_WAITING_APPROVAL, 'Invoice waiting approval'), (INVOICE_WAITING_PAID, 'Invoice waiting paid'), (REPORT_DUE, 'Report due'))

template_map module-attribute

template_map = {COMMENT_TASK: {'text': gettext('{msg}'), 'icon': 'comment', 'url': '{link}', 'type': gettext('Comment')}, SUBMISSION_DRAFT: {'text': gettext('A Submission draft [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting to be submitted'), 'icon': 'comment', 'url': '{link}', 'type': gettext('Draft')}, DETERMINATION_DRAFT: {'text': gettext('Determination draft for submission [<span class="truncate inline-block max-w-32 align-bottom ">{related.submission.title}</span>]({link} "{related.submission.title}") is waiting to be submitted'), 'icon': 'edit-draft', 'url': '{link}', 'type': gettext('Draft')}, REVIEW_DRAFT: {'text': gettext('Review draft for submission [<span class="truncate inline-block max-w-32 align-bottom ">{related.submission.title}</span>]({link} "{related.submission.title}") is waiting to be submitted'), 'icon': 'edit-draft', 'url': '{link}', 'type': gettext('Draft')}, PROJECT_WAITING_PAF: {'text': gettext('Project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for project form'), 'icon': 'dashboard-paf', 'url': '{link}', 'type': gettext('project')}, PROJECT_SUBMIT_PAF: {'text': gettext('Project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for project form submission'), 'icon': 'dashboard-paf', 'url': '{link}', 'type': gettext('project')}, PAF_REQUIRED_CHANGES: {'text': gettext('Project form for project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") required changes or more information'), 'icon': 'dashboard-paf', 'url': '{link}', 'type': gettext('project')}, PAF_WAITING_ASSIGNEE: {'text': gettext('Project form for project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for assignee'), 'icon': 'dashboard-paf', 'url': '{link}', 'type': gettext('project')}, PAF_WAITING_APPROVAL: {'text': gettext('Project form for project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for your approval'), 'icon': 'dashboard-paf', 'url': '{link}', 'type': gettext('project')}, PROJECT_WAITING_CONTRACT: {'text': gettext('Project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for contract'), 'icon': 'dashboard-contract', 'url': '{link}', 'type': gettext('project')}, PROJECT_WAITING_CONTRACT_DOCUMENT: {'text': gettext('Project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for contracting documents'), 'icon': 'dashboard-document', 'url': '{link}', 'type': gettext('project')}, PROJECT_WAITING_CONTRACT_REVIEW: {'text': gettext('Contract for project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for review'), 'icon': 'dashboard-contract', 'url': '{link}', 'type': gettext('project')}, PROJECT_WAITING_INVOICE: {'text': gettext('Project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is waiting for invoice'), 'icon': 'dashboard-invoice', 'url': '{link}', 'type': gettext('project')}, INVOICE_REQUIRED_CHANGES: {'text': gettext('Invoice [{related.invoice_number}]({link}) required changes or more information'), 'icon': 'dashboard-invoice', 'url': '{link}', 'type': gettext('project')}, INVOICE_WAITING_APPROVAL: {'text': gettext('Invoice [{related.invoice_number}]({link}) is waiting for your approval'), 'icon': 'dashboard-invoice', 'url': '{link}', 'type': gettext('project')}, INVOICE_WAITING_PAID: {'text': gettext('Invoice [{related.invoice_number}]({link}) is waiting to be paid'), 'icon': 'dashboard-invoice', 'url': '{link}', 'type': gettext('project')}, REPORT_DUE: {'text': gettext('Report for project [<span class="truncate inline-block max-w-32 align-bottom ">{related.title}</span>]({link} "{related.title}") is due'), 'icon': 'dashboard-report', 'url': '{link}', 'type': gettext('project')}}

get_task_template

get_task_template(request, task, **kwargs)
Source code in hypha/apply/todo/options.py
def get_task_template(request, task, **kwargs):
    related_obj = task.related_object
    code = task.code
    # if related_object is none/deleted and task remain there(edge case, avoiding 500)
    if not related_obj:
        return None

    templates = copy.deepcopy(template_map)
    try:
        template = templates[code]
    except KeyError:
        # Unregistered code
        return None
    template_kwargs = {
        "related": related_obj,
        "link": link_to(related_obj, request),
    }
    if task.code == COMMENT_TASK:
        template_kwargs["msg"] = related_obj.message
    template["text"] = template["text"].format(**template_kwargs)
    template["url"] = template["url"].format(**template_kwargs)
    # additional field
    template["id"] = task.id
    template["user"] = task.user
    return template