Odoo - 在'创建'旁边添加按钮一

时间:2016-12-02 18:30:13

标签: openerp

[解决]

<t t-extend="ListView.buttons">
    <t t-jquery="button.o_list_button_add" t-operation="after">
        <button type="button" class="btn btn-primary btn-sm">
            Create Customer Site
        </button>
    </t>
</t>

他们在&#39; o_list_button_add&#39;中更改了按钮类的名称。在Odoo的第10节。 在web.base中找到它

感谢。

我想在&#39;创建&#39;旁边添加一个按钮。之一。

我尝试使用xpath标记,如下所示:

<template>
    <xpath expr="//div[@class='.o_list_buttons']" position="after">
        <button class="btn btn-primary" name="customer_button"
                string="Create Customer" type="action"/>
    </xpath>
</template>

但它不起作用。

有人知道怎么做吗?

[编辑]

我正在使用Odoo v10。

这里是__manifest __。py

{
'name': "Broadband",

'summary': """
        Manage Network Sites
    """,

'description': """
""",

'author': "Author",
'website': "",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Draft',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base', 'product', 'base_multi_image', 'board', 'backend_theme_v10'],

# always loaded
'data': [
    'security/security.xml',
    'security/ir.model.access.csv',
    'views/views.xml',
    'views/product_view.xml',
    'views/wkf.xml',
    'views/component_view.xml',
    'views/competitor_view.xml',
    'views/voucher_view.xml',
    'views/partner_view.xml',
    'views/provider_view.xml',
    'views/site_board.xml',
    'views/customer.xml',
    'views/interventions.xml',
    'views/states_count.xml',
    'views/notification.xml',
],
# only loaded in demonstration mode
'demo': [
    'demo/demo.xml',
],
'qweb': ['views/templates.xml', 'views/views.xml'],
'installable': True,
'application': True,

}

我在templates.xml中使用你的代码。 我必须告诉Odoo在哪里使用它吗?

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

<t t-extend="ListView.buttons" t-name="add_create_button">
    <t t-jquery="button.o_list_button_add" t-operation="after">
        <button type="button" class="btn btn-primary">
            Create Customer Site
        </button>
    </t>
</t>

</templates>

0 个答案:

没有答案