def req_item():
    """
        REST Controller
        @ToDo: Filter out fulfilled Items?
    """

    # Filter out Template Items
    if request.function != "fema":
        s3.filter = (FS("req_id$is_template") == False)

    def prep(r):

        if r.interactive or r.representation == "aadata":

            list_fields = s3db.get_config("req_req_item", "list_fields")
            list_fields.insert(1, "req_id$site_id")
            levels = gis.get_relevant_hierarchy_levels()
            levels.reverse()
            for level in levels:
                lfield = level % "req_id$site_id$location_id$%s"
                list_fields.insert(1, lfield)
            s3db.configure("req_req_item",
                           insertable = False,
                           list_fields = list_fields,
                           )

            s3.crud_strings["req_req_item"].title_list = T("Requested Items")
            if r.method != None and r.method != "update" and r.method != "read":
                # Hide fields which don't make sense in a Create form
                # - includes one embedded in list_create
                # - list_fields over-rides, so still visible within list itself
                s3db.req_hide_quantities(r.table)

        return True
    s3.prep = prep

    output = s3_rest_controller("req", "req_item")

    if settings.get_req_prompt_match():
        req_item_inv_item_btn = dict(url = URL(c="req", f="req_item_inv_item",
                                               args=["[id]"]),
                                     _class = "action-btn",
                                     label = str(T("Request from Facility")),
                                     )
        if s3.actions:
            s3.actions.append(req_item_inv_item_btn)
        else:
            s3.actions = [req_item_inv_item_btn]

    return output

# -----------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/controllers/req.py/req_item/swapped operands of `%`