'Custom lookup method for activity rows, does a
left join with the parent project. Parameters
key and fields are not used, but are kept for API
compatibility reasons.
@param values: the activity IDs'

def custom_lookup_rows(self, key, values, fields=[]):

    db = current.db
    s3db = current.s3db
    atable = s3db.project_activity
    ptable = s3db.project_project
    left = ptable.on((ptable.id == atable.project_id))
    qty = len(values)
    if (qty == 1):
        query = (atable.id == values[0])
        limitby = (0, 1)
    else:
        query = atable.id.belongs(values)
        limitby = (0, qty)
    rows = db(query).select(atable.id, atable.name, ptable.code, left=left, limitby=limitby)
    self.queries += 1
    return rows
