I wrote a module 'web_menu_action_if' to accomplish this task in Odoo 9.0.
__openerp__.py
#---------------------------------------------------------------------------------------------
#			addons/web_menu_action_if/__openerp__.py
#
# 13.0.7.5.16-t1 jimays
# code--129a-0131-3bbbb54b-8e81-ad5c3982c542--13.0.7.5.16-t1--2.55.04--99.91--RFGkfM=y9Z9IcFW=KgtmZ7
#---------------------------------------------------------------------------------------------
{
    'name': 'Web Menu Action If',
    'category': 'Hidden',
    'author': '©INTER-DIMENSIONAL-SPACE-PORT',
    'website': 'http://inter-dimensional-space-port.net',
    'description': """
So you can have items on the Action menu for a model only for selected views.
Makes any action with xml_id starting with 'action_if_xyz_then_' or 'action_if_not_xyz_then_'
invisible unless the context has or does not have 'action_if_xyz_then': 1.
For example, define an action with id="module.action_if_my_view_then_do_something"
and then on your ir.actions.act_window which loads your view, include context="{'action_if_my_view': 1}".
If you want an action to not appear on your view, use id="module.action_if_not_my_view_then_something_else".
Using this mechanism, I was able to make a Payment Transfer view that has certain actions
and have certain other actions only show up on the default Sales Payments and Purchase Payments views.
        <record id="action_account_payment_transfers" model="ir.actions.act_window">
            <field name="name">Payment Transfers</field>
            <field name="res_model">account.payment</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="context">{
		'default_payment_type': 'transfer',
		'actions_if_payment_transfer': 1,
	    }</field>
            <field name="domain">[('payment_type', '=', 'transfer')]</field>
            <field name="view_id" ref="view_account_payment_transfer_tree"/>
        </record>
        <record id="actions_if_payment_transfer_then_unreconcile_and_cancel" model="ir.actions.server">
            ...
	</record>
        <record id="actions_if_not_payment_transfer_then_create_journal_entry_in_lieu_of_invoice" model="ir.actions.server">
            ...
	</record>
        """,
    'version': '1.0',
    'depends': ['web'],
    'data': [
	'views/assets.xml',
    ],
}
views/assets.xml
<openerp>
    <data>
	<template id="web_menu_action_if_assets_js" name="Web Menu Action If JS Assets" inherit_id="web.assets_backend">
	    <xpath expr="script[last()]" position="after">
                <script type="text/javascript" src="/web_menu_action_if/static/src/js/web_menu_action_if.js"></script>
	    </xpath>
	</template>
    </data>
</openerp>
static/src/js/web_menu_action_if.js
//---------------------------------------------------------------------------------------------
//		addons/web_menu_action_if/static/src/js/web_web_menu_action_if.js
//
// 13.0.7.5.16-t1 jimays
// code--129a-0131-5569d629-9db5-6bbf278af157--13.0.7.5.16-t1--2.59.35--99.03--HcOEijfrP025AMkdHahOoh
//---------------------------------------------------------------------------------------------
// gratitude addons/web/static/src/js/widgets/sidebar.js
// gratitude https://www.odoo.com/forum/help-1/question/how-to-get-context-value-from-js-to-python-function-in-odoo-91728
// gratitude https://stackoverflow.com/questions/9882284/looping-through-array-and-removing-items-without-breaking-for-loop
// gratitude https://www.w3schools.com/jsref/jsref_includes.asp
// gratitude https://stackoverflow.com/questions/47049062/non-greedy-regular-expression-for-javascript
// gratitude https://www.w3schools.com/jsref/jsref_substr.asp
// gratitude https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
odoo.define('web.action_if', function (require) {
'use strict';
var Sidebar = require('web.Sidebar');
var re_actions_if = new RegExp('^[^.]+\.(actions_if_.*?)_then_.+$');
true || console.log('starting web_menu_action_if.js');
Sidebar.include({
    add_toolbar: function(toolbar) {
        var self = this;
	var context = self.getParent().dataset.get_context().eval();
	true || console.log('context: ' + JSON.stringify(context));
        _.each(['print','action','relate'], function(type) {
            var items = toolbar[type];
            if (items) {
		// Make any action with xml_id starting with 'action_if_xyz_then_' or 'action_if_not_xyz_then_'
		// invisible unless the context has or does not have 'action_if_xyz_then': 1.
                for (var i = items.length-1; i >= 0 ; i--) {
		    var matches = re_actions_if.exec(items[i].xml_id);
		    var actions_if = matches ? matches[1] : '';
		    var flip = (actions_if.indexOf('actions_if_not') == 0);
		    if (flip) {
			actions_if = 'actions_if' + actions_if.substr(14);
		    }
		    var visible = (!actions_if
			|| (!flip && context[actions_if]) || (flip && !context[actions_if]));
		    true || console.log(
			'item xml_id: ' + items[i].xml_id
			+ ', actions_if: ' + actions_if + ', flip: ' + flip
			+ ', context[actions_if]: ' + context[actions_if] + ', visible: ' + visible);
		    if (!visible) {
			true || console.log('action invisible: ' + items[i].xml_id);
			items.splice(i, 1);
		    }
		}
		// Repeat code from core web module to install actions in the sidebar.
                for (var i = 0; i < items.length; i++) {
                    items[i] = {
                        label: items[i]['name'],
                        action: items[i],
                        classname: 'oe_sidebar_' + type
                    };
                }
                self.add_items(type=='print' ? 'print' : 'other', items);
            }
        });
    },
});
}); // end odoo.define('', function() {
Enjoy!