问题
Here is my code. I want to hide this action for some records conditionally? I found some tutorials about ir.action.server but did not find the way to hide an action.
<record id="ar_change_state_bulk_assign_id" model="ir.actions.server">
<field name="name">Assign AR Number</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_olims_analysis_request"/>
<field name="state">code</field>
<field name="code">self.bulk_change_states_pre("to_be_sampled",cr, uid, context.get('active_ids'), context=context)</field>
<field name="sequence" eval="5"/>
</record>
<record id="ar_id_of_the_action_value_assing_ar" model="ir.values">
<field name="name">Assign AR Number</field>
<field name="action_id" ref="ar_change_state_bulk_assign_id"/>
<field name="value" eval="'ir.actions.server,'+str(ref('ar_change_state_bulk_assign_id'))"/>
<field name="key">action</field>
<field name="model_id" ref="model_olims_analysis_request"/>
<field name="model">olims.analysis_request</field>
<field name="key2">client_action_multi</field>
</record>
来源:https://stackoverflow.com/questions/49850075/how-to-hide-specific-odoo-server-action-from-action-drop-down-for-some-records-c