Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to make button in tree view header always show up without selecting a record?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
wizardtreeviewbutton
5 Răspunsuri
16457 Vizualizări
Imagine profil
Denny Nur

Hi, in my case i want to create a button inside tree view header to call an existing wizard. my source code is working, but i need to select some record to show my custom button. did missing something or this is a wrong way to create custom button on tree view header?

tree_view.xml

<record id="view_bank_account_tree"model="ir.ui.view">
    <field name="name">bank.account.treefield>
    <field name="model">account.journalfield>
<field name="type">treefield>
<field name="arch"type="xml">
        <tree create='0'string="Bank Account">
         <header>
                <button name="show_wizard"type="object"string="Create"class="oe_highlight"/>
            header>
            <field name="name"/>
            <field name="bank_id"/>
            <field name="bank_bic"/>
        tree>
    field>
record>

model.py

from odoo import models, fields, api

class bank_account(models.Model):
    _inherit='account.journal'
    bank_bic=fields.Char(string='Bank Identifier Code', related='bank_id.bic')

    def show_wizard(self):
    return {
        'name' : 'Add a Bank Account',
        'type' : 'ir.actions.act_window',
        'res_model' : 'account.setup.bank.manual.config',
        'views' : [[False, 'form']],
        'target' : 'new'
}
2
Imagine profil
Abandonează
Imagine profil
Rama Altayeb
Cel mai bun răspuns
For odoo15 Follow this tutorial 

www.cybrosys.com/blog/how-to-add-a-create-button-near-tree-kanban-view-in-odoo-15

For odoo16 Follow the same tutorial 

But put your xml and js files in assets_backend bundle
and then change o_list_button_button to o_list_button_add

 

<t t-extend="ListView.buttons" t-name="some_unique_name">
        <t t-jquery="button.o_list_button_add" t-operation="after">
            <button type="button" class="btn btn-primary open_wizard_action">
                    Open Wizard
            </button>
        </t>
    </t> 


       
           
       
     

    

           

       

   


1
Imagine profil
Abandonează
Imagine profil
Niko
Cel mai bun răspuns

adding  display="always" works for Odoo v18

0
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

Inorder to make a button in the tree view, first you need to create an xml extending the list view buttons.

<templates id="template" xml:space="preserve">


    <t t-extend="ListView.buttons">


        <t t-jquery="div.o_list_buttons" t-operation="append">


            <button type="object" class="btn  btn-class">


                /* button name */


            </button>


        </t>


    </t>


</templates>


And then, you need to add a js file and include the button in ListController and setup the action.

var ListController = require("web.ListController");
var includeEdit = {

renderButtons: function() {
this._super.apply(this, arguments);
this.$buttons.find('button.btn-class').click(this.proxy('btn_function'));
}
},
 
btn_function: function() {
var action = {
type: "ir.actions.act_window",
name: /* Name of Wizard*/,
res_model: /* Wizard Model */,
views: [[false,'form']],
target: 'new',
view_type : 'form',
view_mode : 'form',
context : {/* Context to be passed */},
}
return this.do_action(action);
},
}
ListController.include(includeEdit);
});

Regards

0
Imagine profil
Abandonează
Imagine profil
Denny Nur
Autor Cel mai bun răspuns

thank you, it works correctly but since odoo has default create button and when I try to append it. My tree view shows 2 button create, one from default odoo and the other is custom from mine. is it possible if adding condition on my button? i want my custom button will apear only on my tree and make odoo default button invisible

0
Imagine profil
Abandonează
Imagine profil
XOLUTO
Cel mai bun răspuns

simplest solution for this need is to use   display="always" in button

Example:

 <tree>          

​<header>            

​ ​<button name="action_do_something" string="Button text"              ​ ​

​ ​ ​type="object" display="always"          

​ ​ ​class="btn-primary">

​ ​</button>          

​</header>

-1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Custom Button in Tree View
treeview button
Imagine profil
Imagine profil
1
mai 24
2724
How to call button in <act_window>
treeview button
Imagine profil
Imagine profil
1
feb. 17
6381
[SOLVED] How to make button clickable before setting mandatory fields in wizard ? - odoo 9 Rezolvat
wizard button
Imagine profil
Imagine profil
1
nov. 16
6859
open wizard from tree view
wizard treeview
Imagine profil
Imagine profil
1
ian. 16
8016
How to add a single button in tree view ?
treeview button
Imagine profil
Imagine profil
1
mar. 15
16865
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now