2016-12-02 3 views
3

[gelöst]Odoo - Schaltfläche Hinzufügen neben dem 'Erstellen' ein

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

Sie Namen der Schaltfläche Klasse in 'o_list_button_add' in v10 von Odoo geändert. Fand es in web.base

Dank.


Ich möchte einen Button neben dem 'Create' hinzufügen.

habe ich versucht, mit dem XPath-Tag, wie folgt aus:

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

aber es hat nicht funktioniert.

Weiß jemand, wie man es macht?

[EDIT]

I Odoo v10 verwenden.

Hier ist der __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, 

}

Ich bin Ihr Code innerhalb des templates.xml verwenden. Muss ich Odoo sagen, wo ich es verwenden soll, vielleicht?

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

Antwort

2

Um es nach create Schaltfläche Add:

Für 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> 

Für 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> 

dependancy base Modul hinzufügen in __openerp__.py:

{ 
    ... 

    'depends': ['base'], 

    ... 
} 
+0

Danke für die Antwort, aber es funktioniert nicht. Ich habe versucht, es entweder in der Ansicht oder in der Vorlagen-Datei, aber es fügt nichts hinzu. –

+0

@MicheleZaccheddu Hast du es als qweb Vorlage hinzugefügt? – Zety

+0

Meinst du im Manifest? Ja, habe ich. –

Verwandte Themen