How to hide specific odoo server action from action drop down for some records conditionally?

旧巷老猫 提交于 2019-12-11 05:08:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!