0

大家好,我想从中删除操作按钮odoo-10,该按钮显示在打印旁边的页面顶部。在odoo-7odoo-10被称为更多。

我尝试了下面的代码,但没有奏效。此代码从所有页面中隐藏操作按钮。

def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
    ir_ids = self.pool.get("ir.values").search(cr, user, [('name', '=', 'more_action_id')])
    if context:
        if context.get('pass_any_value_in_context_of action') is True:
            if ir_ids:
                cr.execute("update ir_values set key2 ='client_action_multi' where id in % s", (tuple(ir_ids),))
            if ir_ids:
                cr.execute("update ir_values set key2 = where id in % s", (tuple(ir_ids),))

    return super(product_supplierinfo, self).fields_view_get(cr, user, view_id, view_type, context, toolbar, submenu)
4

1 回答 1

-2

要删除操作按钮,您必须在模块的 view.xml 中执行此操作

例子:

 <record model="ir.ui.view" id="my_saleorder_form">
              <field name="name">my.saleorder.form</field>
              <field name="model">sale.order</field>
              <field name="type">form</field>
              <field name="inherit_id" ref="sale.view_order_form" />
              <field name="arch" type="xml" >
    <xpath expr="//button[@name='action_cancel']" position="replace">

    </xpath>
    </field>

   </record>
于 2017-03-17T13:54:42.557 回答