'Total of project_organisation amounts for project'

@staticmethod
def project_total_organisation_amount(row):

    if (not current.deployment_settings.get_project_multiple_organisations()):
        return 0
    if ('project_project' in row):
        project_id = row['project_project.id']
    elif ('id' in row):
        project_id = row['id']
    else:
        return 0
    table = current.s3db.project_organisation
    query = ((table.deleted != True) & (table.project_id == project_id))
    sum_field = table.amount.sum()
    return current.db(query).select(sum_field).first()[sum_field]
