Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How get the category value in Dashboard

By
sridhar
on 3/14/14, 4:08 AM 854 views

How get the category value in Dashboard, when i clicking the show data button x value come as 0,1,2,... I want to replace the 0 by that product category name. see the attachment i want some values x axis.In x axis image has Category name but i cant get the value in the table.

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 3/24/14, 8:09 AM

Default Dashboard show data x value come as 0,1,2,... from the below code:-

Folder: addons\web_graph\static\lib\flotr2\js\plugins\spreadsheet.js

Default OpenERP Code:-

function getRowLabel(value){
  if (this.options.spreadsheet.tickFormatter){
    //TODO maybe pass the xaxis formatter to the custom tick formatter as an opt-out?
    return this.options.spreadsheet.tickFormatter(value);
  }
  else {
    var t = _.find(this.axes.x.ticks, function(t){return t.v == value;});
    if (t) {
      return t.label;
    }
    return value; /* Default it shows 0, 1, 2 */
  }
}

Based on your requirement to change the below code in spreadsheet.js its shows Product Category Name in x-axis

function getRowLabel(value){
  if (this.options.spreadsheet.tickFormatter){
    //TODO maybe pass the xaxis formatter to the custom tick formatter as an opt-out?
    return this.options.spreadsheet.tickFormatter(value);
  }
  else {
    var t = _.find(this.axes.x.ticks, function(t){return t.v == value;});
    if (t) {
      return t.label;
    }
    return  this.options.xaxis.ticks[value][1]; /* It return x-axis value in Data Dashboard */
  }
}

Yes Yes... It is working... Thank You...

sridhar
on 3/24/14, 9:08 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/14/14, 4:08 AM
Seen: 854 times
Last updated: 3/16/15, 8:10 AM