Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Odoo 8 Reporting : Change default "Total" label

Odebírat

Get notified when there's activity on this post

This question has been flagged
reportingodoo8.0
1 Odpovědět
8147 Zobrazení
Avatar
TEIMI Yassine

I want to change this total label to "Average", How it could be possible ?

-------------------------------------------------------------------------EDIT----------------------------------------------------------------------------------------------

@Axel :

Here is the error : JS test results raising error

And Here is my code :

__openerp__.py

{ 'name''HR appraisals advanced management (Survey enhancements included)': ,
'description':'Advanced appraisals management' ,
'author':'Yassine TEIMI ,
'depends': ['hr_evaluation','survey','web_graph'],
  'data': ['views/survey_templates.xml','views/survey_result.xml','report/hr_evaluation_report_extension_view.xml','static/src/xml/assets_backend.xml'],
}

change_total_label.js : 

(function () {

'use strict';

var _lt = openerp.web._lt;

var _t = openerp.web._t;

openerp.web_graph.PivotTable.include({

find_or_create_header: function (headers, path, data_pt) {

var self = this;

var hdr = _.find(headers, function (header) {

return self.isEqual(path, header.path);

});

if (hdr) {

return hdr;

}

if (!path.length) {

var pivot_header = 'Total';

if(self.context.pivot_header != undefined){

pivot_header = self.context.pivot_header;

}

hdr = this.make_header({title: _t(pivot_header)});

headers.push(hdr);

return hdr;

}

hdr = this.make_header({

path:path,

domain:data_pt.model._domain,

title: _t(_.last(path))

});

var parent = _.find(headers, function (header) {

return self.isEqual(header.path, _.initial(path, 1));

});

var previous = parent.children.length ? _.last(parent.children) : parent;

headers.splice(headers.indexOf(previous) + 1, 0, hdr);

parent.children.push(hdr);

return hdr;

},

});

})();

assets_backend.xml : 

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

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

<script type="text/javascript" src="/hr_appraisals_adv/static/src/js/change_total_label.js"></script>

</xpath>

</template>

my reporting action, where I need to passe the pivot header : 

<record id="action_evaluation_goals_reaching" model="ir.actions.act_window">
<field name="name">Atteinte des objectifs</field>
<field name="res_model">hr.evaluation.report.goals</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="search_view_id" ref="view_goals_reaching_search"/>
<field name="context">{'pivot_header': 'Moyenne'}</field> <!-- just added here the label in french -->
</record>
0
Avatar
Zrušit
Avatar
Axel Mendoza
Nejlepší odpověď

You need to do it by extending the widget because that label it's hard-coded in the widget. For that you need to register your js file in the web.assets_backend template like:

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

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

<script type="text/javascript" src="/your_module/static/src/js/your_file.js"></script>

</xpath>

</template>

In your_file.js you need to extend the widget like:

openerp.hr_appraisals_adv = function (openerp) {

var _lt = openerp.web._lt;

var _t = openerp.web._t;

openerp.web_graph.PivotTable.include({

find_or_create_header: function (headers, path, data_pt) {

var self = this;

var hdr = _.find(headers, function (header) {

return self.isEqual(path, header.path);

});

if (hdr) {

return hdr;

}

if (!path.length) {

var pivot_header = 'Total';

if(self.context.pivot_header != undefined){

pivot_header = self.context.pivot_header;

}

hdr = this.make_header({title: _t(pivot_header)});

headers.push(hdr);

return hdr;

}

hdr = this.make_header({

path:path,

domain:data_pt.model._domain,

title: _t(_.last(path))

});

var parent = _.find(headers, function (header) {

return self.isEqual(header.path, _.initial(path, 1));

});

var previous = parent.children.length ? _.last(parent.children) : parent;

headers.splice(headers.indexOf(previous) + 1, 0, hdr);

parent.children.push(hdr);

return hdr;

},

});

};

With that extension you can change the label of the Total pivot header by put the value under the key 'pivot_header' of the context dict of the action that load your graph view.
For example:

<record model="ir.actions.act_window" id="your_record_id">

<field name="name">Model View Name</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">your_model</field>

<field name="view_type">form</field>

<field name="view_mode">graph,tree,form</field>

<field name="context">{'pivot_header': 'Average'}</field>

</record>

Result:

1
Avatar
Zrušit
TEIMI Yassine
Autor

@Axel, I've tested it and gave this js error : Uncaught TypeError: viewclass is not a function, located on : /js/web.assets_backend/a7b03df:3143

Axel Mendoza

Could you run it again but with developer mode active and post the error? developer mode will throw you a more accurate error message. I test that solution locally and get it working. Try to post your code too

TEIMI Yassine
Autor

I posted the error by editing my question.

Axel Mendoza

Did you have a dependency with the module web_graph in your module __openerp__.py??

TEIMI Yassine
Autor

Added the dependacy, restarted the server, here is the error raised after running test from developper mode : http://prntscr.com/9hmcem

TEIMI Yassine
Autor

See my edited question for code details.

Axel Mendoza

I update the js file of my answer to properly fix that error.

TEIMI Yassine
Autor

Great it works fine, Thanks a lot, I really appreciate your help!

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
how to add many2many field to pivot report, Odoo8
reporting odoo8.0 pivot
Avatar
0
úno 21
3836
Connection in qweb xml reports
reporting report odoo8.0
Avatar
0
čvc 17
3553
Canned reports in Odoo 17 for all the modules
reporting
Avatar
Avatar
1
lis 24
2374
Profit and lost account
reporting
Avatar
0
srp 24
2135
how to implement joint piece in odoo 8 in one view
odoo8.0
Avatar
0
dub 24
2540
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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