Удалить кнопку действия (дополнительно) в odoo?

Привет всем, я хочу удалить кнопку действия из odoo-10, которая отображается вверху страницы рядом с печатью. В odoo-7 и odoo-10 он известен как More.

Я попробовал код ниже, но это не сработало. Этот код скрывает кнопку действия со всех страниц.

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)

person Palkesh Baraiya    schedule 19.12.2016    source источник
comment
Здравствуйте, вы нашли решение этой проблемы?   -  person enigmq    schedule 30.11.2017


Ответы (1)


Чтобы удалить кнопку действия, вы должны сделать это в своем 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>
person Tihomir Tashev    schedule 17.03.2017