Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to add button in tree view header near "Create" and "Import" buttons Odoo 8 ?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
headerbuttonsodooodooV8odoo8.0
1 Respondre
15931 Vistes
Avatar
Roman Gr.

I can successfully add buttons in form view header or in tree view rows, but i want add custom button in tree view header near "Create" and "Import" buttons in Odoo 8. How can i do this?

2
Avatar
Descartar
Avatar
Roman Gr.
Autor Best Answer

I find solution of my problem! I replace create button if I use project.project model.
1) I create some js script (static/src/js/task_list.js) with click listener for my button :
  
openerp.project = function (instance){       

        var QWeb = openerp.web.qweb;
        _t = instance.web._t;
        var self = this;
        openerp.web.ListView.include({       

                load_list: function(data) {           

                                       this._super(data);
                                       if (this.$buttons) {               

                                                  this.$buttons.find('.oe_new_button').off().click(this.proxy('do_the_job')) ;
                                                  console.log('Save & Close button method call...');
                                      }       

                                                      },       

                                     do_the_job: function () {           

                                               this.do_action({               

                                                        type: "ir.actions.act_window",               

                                                        name: "Создание нового проекта",               

                                                        res_model: "project.project",               

                                                        views: [[false,'form']],               

                                                        target: 'current',               

                                                        view_type : 'form',               

                                                        view_mode : 'form',               

                                                        flags: {'form': {'action_buttons': true, 'options': {'mode': 'edit'}}}});
                                              return { 'type': 'ir.actions.client',                    'tag': 'reload', } } });
    }    


2) After that I create static/src/xml/project_button.xml with template, which replace "Create" button if I use project.project model


<?xml version="1.0" encoding="UTF-8"?>

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

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

                 <t t-jquery="button.oe_list_add" t-operation="replace">                           

                          <button t-if="widget.model == 'project.project'"  class="oe_button oe_new_button oe_highlight" type="button">Создать новый проект</button>                           

                          <button t-if="widget.model != 'project.project'" class="oe_button oe_list_add oe_highlight" type="button">Создать</button>           

                </t>       

          </t>   

</template>


3) After that I add my js script in web.asset_backend (I create file project/views/project.xml)


<?xml version="1.0" encoding="utf-8"?>   

<!-- vim:fdn=3:
    -->   

          <openerp>       

                 <data>           

                       <template id="assets_backend" name="project assets" inherit_id="web.assets_backend">               

                             <xpath expr="." position="inside">                   

                                  <script type="text/javascript" src="/project/static/src/js/task_list.js"></script>               

                             </xpath>           

              </template>       

         </data>   

</openerp>


4) And finally I add in project/\_\_openerp__.py section 'qweb' for static/src/xml/project_button.xml, 'js' for static/src/js/task_list.js and place file views/project.xml in 'data' section.


'data': [           

'security/project_security.xml',            

...
'views/project.xml',       

],       

'qweb': ['static/src/xml/project_button.xml',],       

...
 'js': 'static/src/js/task_list.js',


And my button successful replace old button in project.project model.

3
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
odoo 8.0 opening balance doesn't appear in balance sheet and trail balance
odoo odooV8 odoo8.0
Avatar
Avatar
1
de des. 24
5011
set default user Solved
odoo odooV8 odoo8.0
Avatar
Avatar
1
de nov. 16
10435
TRANSFER ODOO V8 DATABASE TO ANOTHER PC BUT CANT BOOT WINDOWS 7
odoo odooV8 odoo8.0
Avatar
Avatar
1
de febr. 16
4586
Keeping excel fonts Same? Odoo 8
odoo odooV8 odoo8.0
Avatar
0
de març 15
3984
Bold in List View for Many Records?
odoo odooV8 odoo8.0
Avatar
Avatar
1
de març 15
6571
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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