Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Odoo 12, how to add a button to treeview header and call the existing wizard?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
wizardtreeviewbuttonsodoo12
2 Antwoorden
9363 Weergaven
Avatar
gain charlie

Hi,

      I been do some research on this site, but none works for me.

i am new to odoo 12. 

i am not that familiar with js as well.

Thank you for sharing you time to help.


0
Avatar
Annuleer
Avatar
Pablo Escobar
Beste antwoord

I find the solution to this problem! If you want to replace the create button if you use project.project model.

1) Create some js script (static/src/js/task_list.js) with click listener for the 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 create static/src/xml/project_button.xml with the template, which replaces "Create" button if 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 add my js script in web.asset_backend (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 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 the button successful replace old button in project.project model.



1
Avatar
Annuleer
gain charlie
Auteur

It's seem the solution is in older odoo version.

Can you give me the solution in Odoo 12 up?

Hilar Andikkadavath

@pablo Escobar, You copied the answer from the reference link that I mentioned. What are you trying to prove here?

Avatar
Hilar Andikkadavath
Beste antwoord

I can give u a reference which described well, that how we can add a button in tree view header.

https://stackoverflow.com/questions/42694793/how-to-add-button-in-tree-view-header-near-create-and-import-buttons-odoo-8

0
Avatar
Annuleer
gain charlie
Auteur

HI Hilar,

Can you upgrade the solution to Odoo 12 up?

Am using the Odoo 12 and not familiar with openerp api in odoo 8

Thank you for you time.

Hilar Andikkadavath

I already mentioned this in answer, this is just a reference. You can follow the way they did.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
In Odoo 12, How to create a new button alongside CREATE button of a treeview and call a wizard
wizard treeview buttons odoo12
Avatar
Avatar
1
okt. 19
3864
How to add Button on treeview header and to call a wizard from Odoo 12? Opgelost
treeview buttons odoo12
Avatar
Avatar
1
apr. 24
14248
How to add buttons in tree view header and run a function in Odoo 12?
treeview buttons odoo12
Avatar
Avatar
1
okt. 19
7784
add one button in treeview to sync many records from another app API Opgelost
treeview buttons
Avatar
Avatar
2
jun. 22
3541
Prevent wizard from being closed odoo 12
wizard odoo12
Avatar
Avatar
Avatar
2
sep. 20
6924
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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