'Virtual Field to show the percentage completion of the Indicator'

@staticmethod
def project_indicator_percentage(row):

    if hasattr(row, 'project_indicator_data'):
        row = row.project_indicator_data
    if hasattr(row, 'target_value'):
        planned = row.target_value
        if (planned is None):
            return current.messages['NONE']
    else:
        planned = None
    if hasattr(row, 'value'):
        actual = row.value
        if (actual is None):
            return current.messages['NONE']
    else:
        actual = None
    if (((planned is None) or (actual is None)) and hasattr(row, 'id')):
        table = current.s3db.project_indicator_data
        r = current.db((table.id == row.id)).select(table.target_value, table.value, limitby=(0, 1)).first()
        if r:
            planned = r.target_value
            actual = r.value
    if ((planned is not None) and (actual is not None)):
        if (planned == 0.0):
            if (actual == 0.0):
                return current.messages['NONE']
            else:
                return project_status_represent(100.0)
        percentage = ((actual / planned) * 100)
        return project_status_represent(percentage)
    return current.messages['NONE']
