如何隐藏odoo9中表单视图的操作下拉列表中的项目?

时间:2016-07-02 04:55:07

标签: openerp odoo-8 odoo-9 odoo-view

我想隐藏来自视图的操作下拉列表中的两个选项。当我搜索时,我看到它是通过使用act_window添加的。我怎样才能隐藏这些物品。

请看这个图像..

http://i.stack.imgur.com/tumP5.png

1 个答案:

答案 0 :(得分:0)

我得到了答案。我删除了原始的act_window记录并创建了一个新记录,并更改了工作表中“Put Money IN”和“Take Money Out”按钮的操作。以下是代码,

  <delete id="point_of_sale.action_pos_box_in" model="ir.actions.act_window"/>
  <delete id="point_of_sale.action_pos_box_out" model="ir.actions.act_window"/>

  <record id="misc_action_pos_box_in" model="ir.actions.act_window">
       <field name="name">Put Money In</field>
       <field name="res_model">cash.box.in</field>
       <field name="view_mode">form</field>
       <field name="target">new</field>
       <field name="src_model">pos.session</field>
       <field name="key2"></field>
   </record>

   <record id="misc_action_pos_box_out" model="ir.actions.act_window">
       <field name="name">Take Money Out</field>
       <field name="res_model">cash.box.out</field>
       <field name="view_mode">form</field>
       <field name="target">new</field>
       <field name="src_model">pos.session</field>
       <field name="key2"></field>
   </record>

   <record model="ir.ui.view" id="misc_view_pos_session_form">
       <field name="name">misc.pos.session.form</field>
       <field name="model">pos.session</field>
       <field name="inherit_id" ref="point_of_sale.view_pos_session_form"/>
       <field name="arch" type="xml">
           <xpath expr="//sheet//div[@name='button_box']//button[1]" position="replace">
               <button class="oe_stat_button" name="%(misc_action_pos_box_in)d"
                       type="action" icon="fa-level-down"
                       attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', 'not in', ['opened', 'closing_control'])]}">
                   <div class="o_form_field o_stat_info">
                       <span class="o_stat_text">Put</span>
                       <span class="o_stat_text">Money In</span>
                   </div>
               </button>
           </xpath>
           <xpath expr="//sheet//div[@name='button_box']//button[2]" position="replace">
               <button class="oe_stat_button" name="%(misc_action_pos_box_out)d"
                       type="action" icon="fa-level-up"
                       attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', 'not in', ['opened', 'closing_control'])]}">
                   <div class="o_form_field o_stat_info">
                       <span class="o_stat_text">Take</span>
                       <span class="o_stat_text">Money Out</span>
                   </div>
               </button>
           </xpath>
       </field>
   </record>