gpt4 book ai didi

Odoo - 在 'Create' 旁边添加按钮

转载 作者:行者123 更新时间:2023-12-02 21:10:02 24 4
gpt4 key购买 nike

[已解决]

<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>

他们更改了 Odoo v10 中“o_list_button_add”中按钮类的名称。在 web.base 中找到它

谢谢。

<小时/>

我想在“创建”按钮旁边添加一个按钮。

我尝试使用 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>

最佳答案

要在创建按钮后添加它,请使用:

对于ListView:

<template xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<!-- Your button here -->
</t>
</t>
</template>

对于FormView:

<t t-extend="FormView.buttons">
<t t-jquery="button.oe_form_button_create" t-operation="after">
<button type="button">My button</button>
</t>
</t>

__openerp__.py中添加对base模块的依赖:

{
...

'depends': ['base'],

...
}

关于Odoo - 在 'Create' 旁边添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40938806/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com