def get_treeview_action(self, **options):
    """Return the tree view action for `self`.

    If the `self` is a singleton, return the view type 'form' so that it's
    easier to see the full object.

    :rtype: An action `dict` you can return to the web client.

    `options` is used to override **almost any** key in the returned dict.  An
    interesting option is `target`.

    """
    _, _, context = self.env.args
    ids = self.ids
    if not ids or len(ids) > 1:
        vtype = "list"
        active_id = None
    else:
        vtype = "form"
        active_id = ids[0]
    result = {
        "type": "ir.actions.act_window",
        "res_model": self._name,
        "src_model": False,
        "view_id": False,
        "view_type": vtype,
        "view_mode": "list,form",
        "views": [(False, "list"), (False, "form")],
        "target": "current",
        "context": context,
    }
    if ids:
        result["domain"] = [("id", "in", tuple(ids))]
    if active_id:
        result["active_id"] = active_id
    result.update(options)
    return result