You have to add the custom button in listview and add the condition your according.
Reference:
syntax:
frappe.listview_settings["Your DocType"] = {
refresh: function(listview) {
listview.page.add_menu_item(__("Menu"));
listview.page.add_action_item(__("Actions"));
listview.page.set_primary_action('Primary Button');
listview.page.set_secondary_action('Secondary Button');
listview.page.add_inner_button("Inner Button");
}
};