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

how to add a button/field on the header of "tree" view?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
treeviewtree_view
9 Antwoorden
28141 Weergaven
Avatar
vx2008

I want to add a button and a field on the header of "tree" view at "create" and "import" button; 

how shall I do / set for this? or shall I to do this?

0
Avatar
Annuleer
peter

hi, did you manage to fix this ? I am using Odoo 11 and having the same problem.

OdooBot

i am sorry. i dont resolve this problem until now.

------------------ 原始邮件 ------------------
发件人: "peter"<hoth.peter@gmail.com>
发送时间: 2018年5月5日(星期六) 凌晨0:16
收件人: "vx2008"<caofa@foxmail.com>;
主题: Re: how to add a button/field on the header of "tree" view?

hi, did you manage to fix this ? I am using Odoo 11 and having the same problem.

--
peter


Sent by Odoo S.A. using Odoo.

Avatar
Odoo Developer
Beste antwoord


Create an xml file for qweb and also add in __openerp__.py

Example:

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



In qweb.xml


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

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

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


     <T t-jquery = "button.oe_list_add" t-operation = "after">
        <T t if = "widget.model == 'YOUR.MODEL'">
             <Button class = "oe_button" type = "button"> YOU BUTTON </ button>
         </ T>
     </ T>
</ T>
0
Avatar
Annuleer
vx2008
Auteur

there something eroro:

ERROR MeiTek openerp.http: Exception during JSON request handling.

ParseError: not well-formed (invalid token): line 10, column 67

<T t if = "widget.model == 'YOUR.MODEL'"> modified into <T t-if = "widget.model == 'Detection'">, <Button class = "oe_button" type = "button"> YOU BUTTON </ button> modified into <Button class = "oe_button" type = "button"> register</ button>

When I delete the "qweb" file, all is ok;

Maybe shall I add a common "field" instead of "button"?

vx2008
Auteur

I have modified a little about your code as below:

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

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

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

<T t-jquery = "button.oe_list_add" t-operation = "after">

<T t-if = "widget.model == 'Detection'">

<button class = "oe_button" type = "button" string="Test"> register</button>

</T>

</T>

</T>

</templates>

in .py file:

@api.multi

def register(self):

print 'just a test!'

return True

my this module name: "Detection"; and I also created an qweb file as your request in "../addons/Detection/static/src/xml/qweb.xml";

when I modified the file and restart Odoo and update the "Detection" module; there is no error, but when I open the "tree", nothing changed.

Odoo Developer

You add your model name here .(Not module name)

Example :

<T t if = "widget.model == 'sale.order'">

The button will be appear in the tree view of sale.order

vx2008
Auteur

Thank you for you constant support; I have a try for that, but I still can;t see the button in tree view; now I will show all files here:

__init__.py : from . import meeting_model

__openerp__.py:

'name': 'Meeting Application',

'description': 'Publish a meeting',

'author': 'Odoo',

'application': True,

'qweb': ['qweb.xml'],

'data': ['meeting_view.xml']

}

meeting_model.py:

# -*- coding: utf-8 -*-

from openerp import models, fields,api

class MeetingTask(models.Model):

_name = 'meeting.task'

_description = 'Meeting task'

Theme = fields.Char('theme')

@api.multi

def register(self):

self.Theme='Just a test!'

qweb.xml:

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

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

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

<T t-jquery = "button.oe_list_add" t-operation = "after">

<T t-if = "widget.model == 'meeting.task'">

<button class = "oe_button" type = "button" >register</button>

</T>

</T>

</T>

</templates>

meeting_view.xml:

<?xml version="1.0"?>

<openerp>

<data>

<!-- Action to open To-Do Task list -->

<act_window id="action_meeting_task"

name="Meeting Tasks"

res_model="meeting.task"

view_mode="tree,form" />

<!-- Menu Item to open To-Do Task list -->

<menuitem id="menu_meeting_task"

name="Meeting"

sequence="20"

action="action_meeting_task" />

<!-- To-Do Task Form view -->

<record id="view_form_meeting_task" model="ir.ui.view">

<field name="name">Meeting Task Form</field>

<field name="model">meeting.task</field>

<field name="arch" type="xml">

<form>

<button name="register" type="object" string="Participate" />

<group name="group_top">

<field name="Theme"/>

</group>

</form>

</field>

</record>

<!-- To-Do Task List view -->

<record id="view_tree_meeting_task" model="ir.ui.view">

<field name="name">Meeting Task Tree</field>

<field name="model">meeting.task</field>

<field name="arch" type="xml">

<tree>

<field name="Theme"/>

</tree>

</field>

</record>

</data>

</openerp>

in addition, could you give me an example which add button/fields at create/import buttons on "tree" view? my email: 116599778@qq.com; thank you again!

Odoo Developer

I created the following module in odoo v9 and it works.

==================================================

◰ button_tree

-|___◰static

-|-----|___◰description

-|-----|___◰src

-|---------|___◰xml

-|--------------|___☐qweb.xml

-|___☐__init__.py

-|___☐__openerp__.py

==================================================

1) __init__.py : <empty>

2) __openerp__.py:

{

'name': 'Button at top of Tree',

'version': '1.0',

'author': 'Shameem',

'category': '',

'description': """ """,

'depends': ['sale'],

'data': [],

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

'demo': [],

'installable': True,

'auto_install': False,

}

3) qweb.xml

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

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

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

<t t-jquery="button.o_list_button_add" t-operation="after">

<t t-if="widget.model=='sale.order'">

<button class="oe_button oe_highlight"

type="button">Custom Button</button>

</t>

</t>

</t>

</templates>

Avatar
Fotic
Beste antwoord

Probably im late but i will post it if someone need it in the future.

on Odoo 12 is modelName NOT model 

<t t-if="widget.modelName == 'stock.quant'">
 <button id="custom_print_btn" class="btn btn-primary o_list_button_custom_print" type="button" >Print</button> 
</t>
0
Avatar
Annuleer
Matt Pedrosa

where on the tree view code did you put this sir?

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
How to show a new column in tree view for Sale Module
treeview tree_view v17
Avatar
Avatar
1
jul. 24
2081
How to create a new tree view for the model account.move
treeview account.move tree_view
Avatar
Avatar
1
jul. 22
3892
Error while printing a tree: Can't render view base.view_partner_form for model: res.partner
treeview tree tree_view
Avatar
1
apr. 16
4667
select check box for tree view inside a form
treeview xml tree_view
Avatar
0
aug. 15
8934
Show a field from many2many relationship in a tree view Opgelost
treeview tree many2many tree_view
Avatar
Avatar
Avatar
Avatar
4
jun. 25
12365
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