1

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

也请看这张图。。

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

4

1 回答 1

1

我得到了答案。我删除了原始的 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>
于 2016-07-02T07:10:24.363 回答