[FIX] incompatibility between dhtmlx.Scheduler and dhtmlx.Chart, bug in dhtmlx.Chart when first data serties contains the value 0 in some places, race condition in graph addon

bzr revid: xmo@openerp.com-20110620170922-9443v3gtqza3vu2z
This commit is contained in:
Xavier Morel
2011-06-20 19:09:22 +02:00
10 changed files with 414 additions and 3081 deletions
+2 -2
View File
@@ -117,8 +117,8 @@ openerp.base.ViewManager = openerp.base.Controller.extend({
var view = this.views[view_type];
if (!view.controller) {
// Lazy loading of views
var controllerclass = openerp.base.views.get_object(view_type);
var controller = new controllerclass( this, this.session, this.element_id + "_view_" + view_type, this.dataset, view.view_id);
var ControllerClass = openerp.base.views.get_object(view_type);
var controller = new ControllerClass( this, this.session, this.element_id + "_view_" + view_type, this.dataset, view.view_id);
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
@@ -6,47 +6,6 @@ to use it in not GPL project. Please contact sales@dhtmlx.com for details
(c) DHTMLX Ltd.
*/
dhtmlx = function (B) {
for (var A in B) {
dhtmlx[A] = B[A]
}
return dhtmlx
};
dhtmlx.extend_api = function (A, D, C) {
var B = window[A];
if (!B) {
return
}
window[A] = function (G) {
if (G && typeof G == "object" && !G.tagName && !(G instanceof Array)) {
var F = B.apply(this, (D._init ? D._init(G) : arguments));
for (var E in dhtmlx) {
if (D[E]) {
this[D[E]](dhtmlx[E])
}
}
for (var E in G) {
if (D[E]) {
this[D[E]](G[E])
} else {
if (E.indexOf("on") == 0) {
this.attachEvent(E, G[E])
}
}
}
} else {
var F = B.apply(this, arguments)
}
if (D._patch) {
D._patch(this)
}
return F || this
};
window[A].prototype = B.prototype;
if (C) {
dhtmlXHeir(window[A].prototype, C)
}
};
dhtmlxAjax = {
get: function (A, C) {
var B = new dtmlXMLLoaderObject(true);
@@ -3732,4 +3691,4 @@ This software is allowed to use under GPL or you need to obtain Commercial or En
to use it in not GPL project. Please contact sales@dhtmlx.com for details
(c) DHTMLX Ltd.
*/
*/
@@ -1,42 +1,11 @@
/*
dhtmlxScheduler v.2.3
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
to use it in not GPL project. Please contact sales@dhtmlx.com for details
(c) DHTMLX Ltd.
*/
dhtmlx=function(obj){
for (var a in obj) dhtmlx[a]=obj[a];
return dhtmlx; //simple singleton
};
dhtmlx.extend_api=function(name,map,ext){
var t = window[name];
if (!t) return; //component not defined
window[name]=function(obj){
if (obj && typeof obj == "object" && !obj.tagName && !(obj instanceof Array)){
var that = t.apply(this,(map._init?map._init(obj):arguments));
//global settings
for (var a in dhtmlx)
if (map[a]) this[map[a]](dhtmlx[a]);
//local settings
for (var a in obj){
if (map[a]) this[map[a]](obj[a]);
else if (a.indexOf("on")==0){
this.attachEvent(a,obj[a]);
}
}
} else
var that = t.apply(this,arguments);
if (map._patch) map._patch(this);
return that||this;
};
window[name].prototype=t.prototype;
if (ext)
dhtmlXHeir(window[name].prototype,ext);
};
/*
dhtmlxScheduler v.2.3
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
to use it in not GPL project. Please contact sales@dhtmlx.com for details
(c) DHTMLX Ltd.
*/
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
@@ -908,7 +877,7 @@ dhtmlxEventable=function(obj){
}
}
}
/**
* @desc: constructor, data processor object
* @param: serverProcessorURL - url used for update
@@ -1489,7 +1458,7 @@ dataProcessor.prototype={
};
//(c)dhtmlx ltd. www.dhtmlx.com
//(c)dhtmlx ltd. www.dhtmlx.com
dataProcessor.prototype._o_init = dataProcessor.prototype.init;
dataProcessor.prototype.init=function(obj){
this._console=this._console||this._createConsole();
@@ -1654,7 +1623,7 @@ dataProcessor.wrap("afterUpdateCallback",function(sid,tid,action){
/*
dhx_sort[index]=direction
dhx_filter[index]=mask
@@ -1792,7 +1761,7 @@ if (window.dataProcessor){
dhtmlxError.catchError("LoadXML",function(a,b,c){
alert(c[0].responseText);
});
window.dhtmlXScheduler=window.scheduler={version:2.2};
dhtmlxEventable(scheduler);
scheduler.init=function(id,date,mode){
@@ -2434,7 +2403,7 @@ scheduler.getLabel = function(property, key) {
}
}
return "";
};
};
scheduler.date={
date_part:function(date){
date.setHours(0);
@@ -2568,7 +2537,7 @@ scheduler.date={
return this.getISOWeek(ndate);
}
}
scheduler.locale={
date:{
month_full:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
@@ -2609,7 +2578,7 @@ scheduler.locale={
}
}
/*
%e Day of the month without leading zeros (01..31)
%d Day of the month, 2 digits with leading zeros (01..31)
@@ -2715,7 +2684,7 @@ scheduler.init_templates=function(){
}
scheduler.uid=function(){
if (!this._seed) this._seed=(new Date).valueOf();
return this._seed++;
@@ -3260,7 +3229,7 @@ scheduler.getEvents = function(from,to){
result.push(ev);
}
return result;
};
};
scheduler._loaded={};
scheduler._load=function(url,from){
url=url||this._load_url;
@@ -3445,7 +3414,7 @@ scheduler.attachEvent("onXLE",function(){
this.config.show_loading=true;
}
});
scheduler.ical={
parse:function(str){
var data = str.match(RegExp(this.c_start+"[^\f]*"+this.c_end,""));
@@ -3510,7 +3479,7 @@ scheduler.ical={
e_start:"BEGIN:VEVENT",
e_end:"END:VEVENT",
c_end:"END:VCALENDAR"
};
};
scheduler.form_blocks={
textarea:{
render:function(sns){
@@ -3850,7 +3819,7 @@ scheduler._get_lightbox=function(){
}
return this._lightbox;
}
scheduler._lightbox_template="<div class='dhx_cal_ltitle'><span class='dhx_mark'>&nbsp;</span><span class='dhx_time'></span><span class='dhx_title'></span></div><div class='dhx_cal_larea'></div><div class='dhx_btn_set'><div class='dhx_save_btn'></div><div>&nbsp;</div></div><div class='dhx_btn_set'><div class='dhx_cancel_btn'></div><div>&nbsp;</div></div><div class='dhx_btn_set' style='float:right;'><div class='dhx_delete_btn'></div><div>&nbsp;</div></div>";
scheduler._lightbox_template="<div class='dhx_cal_ltitle'><span class='dhx_mark'>&nbsp;</span><span class='dhx_time'></span><span class='dhx_title'></span></div><div class='dhx_cal_larea'></div><div class='dhx_btn_set'><div class='dhx_save_btn'></div><div>&nbsp;</div></div><div class='dhx_btn_set'><div class='dhx_cancel_btn'></div><div>&nbsp;</div></div><div class='dhx_btn_set' style='float:right;'><div class='dhx_delete_btn'></div><div>&nbsp;</div></div>";
scheduler._dp_init=function(dp){
dp._methods=["setEventTextStyle","","changeEventId","deleteEvent"];
@@ -3928,4 +3897,4 @@ scheduler._update_callback = function(upd,id){
data.end_date = scheduler.templates.xml_date(data.end_date);
scheduler.addEvent(data);
};
};
@@ -1,33 +1,3 @@
dhtmlx=function(obj){
for (var a in obj) dhtmlx[a]=obj[a];
return dhtmlx; //simple singleton
};
dhtmlx.extend_api=function(name,map,ext){
var t = window[name];
if (!t) return; //component not defined
window[name]=function(obj){
if (obj && typeof obj == "object" && !obj.tagName && !(obj instanceof Array)){
var that = t.apply(this,(map._init?map._init(obj):arguments));
//global settings
for (var a in dhtmlx)
if (map[a]) this[map[a]](dhtmlx[a]);
//local settings
for (var a in obj){
if (map[a]) this[map[a]](obj[a]);
else if (a.indexOf("on")==0){
this.attachEvent(a,obj[a]);
}
}
} else
var that = t.apply(this,arguments);
if (map._patch) map._patch(this);
return that||this;
};
window[name].prototype=t.prototype;
if (ext)
dhtmlXHeir(window[name].prototype,ext);
};
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
@@ -1,33 +1,3 @@
dhtmlx=function(obj){
for (var a in obj) dhtmlx[a]=obj[a];
return dhtmlx; //simple singleton
};
dhtmlx.extend_api=function(name,map,ext){
var t = window[name];
if (!t) return; //component not defined
window[name]=function(obj){
if (obj && typeof obj == "object" && !obj.tagName){
var that = t.apply(this,(map._init?map._init(obj):arguments));
//global settings
for (var a in dhtmlx)
if (map[a]) this[map[a]](dhtmlx[a]);
//local settings
for (var a in obj){
if (map[a]) this[map[a]](obj[a]);
else if (a.indexOf("on")==0){
this.attachEvent(a,obj[a]);
}
}
} else
var that = t.apply(this,arguments);
if (map._patch) map._patch(this);
return that||this;
};
window[name].prototype=t.prototype;
if (ext)
dhtmlXHeir(window[name].prototype,ext);
};
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
@@ -2,37 +2,6 @@
Copyright DHTMLX LTD. http://www.dhtmlx.com
To use this component please contact sales@dhtmlx.com to obtain license
*/
dhtmlx=function(obj){
for (var a in obj) dhtmlx[a]=obj[a];
return dhtmlx; //simple singleton
};
dhtmlx.extend_api=function(name,map,ext){
var t = window[name];
if (!t) return; //component not defined
window[name]=function(obj){
if (obj && typeof obj == "object" && !obj.tagName){
var that = t.apply(this,(map._init?map._init(obj):arguments));
//global settings
for (var a in dhtmlx)
if (map[a]) this[map[a]](dhtmlx[a]);
//local settings
for (var a in obj){
if (map[a]) this[map[a]](obj[a]);
else if (a.indexOf("on")==0){
this.attachEvent(a,obj[a]);
}
}
} else
var that = t.apply(this,arguments);
if (map._patch) map._patch(this);
return that||this;
};
window[name].prototype=t.prototype;
if (ext)
dhtmlXHeir(window[name].prototype,ext);
};
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
File diff suppressed because it is too large Load Diff
@@ -3,15 +3,15 @@ Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
/*
2010 September 30
*/
/* DHX DEPEND FROM FILE 'assert.js'*/
/*
2010 September 30
*/
/* DHX DEPEND FROM FILE 'assert.js'*/
if (!window.dhtmlx)
dhtmlx={};
@@ -250,12 +250,12 @@ if (dhtmlx.assert_enabled()){
return t;
};
}
/* DHX DEPEND FROM FILE 'dhtmlx.js'*/
}
/* DHX DEPEND FROM FILE 'dhtmlx.js'*/
/*DHX:Depend assert.js*/
/*
@@ -760,12 +760,12 @@ dhtmlx.html={
}
})();
dhtmlx.ui={};
/* DHX DEPEND FROM FILE 'destructor.js'*/
dhtmlx.ui={};
/* DHX DEPEND FROM FILE 'destructor.js'*/
/*
Behavior:Destruction
@@ -820,12 +820,12 @@ dhtmlx.event(window,"unload",function(){
ev[0].detachEvent("on"+ev[1],ev[2]);
delete dhtmlx._events[a];
}
});
/* DHX DEPEND FROM FILE 'math.js'*/
});
/* DHX DEPEND FROM FILE 'math.js'*/
dhtmlx.math = {};
dhtmlx.math._toHex=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
dhtmlx.math.toHex = function(number, length){
@@ -841,12 +841,12 @@ dhtmlx.math.toHex = function(number, length){
};
/* DHX DEPEND FROM FILE 'map.js'*/
/* DHX DEPEND FROM FILE 'map.js'*/
/*DHX:Depend dhtmlx.js*/
dhtmlx.ui.Map = function(key){
@@ -894,19 +894,19 @@ dhtmlx.ui.Map.prototype = {
this._map = [];
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_base.js'*/
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_base.js'*/
/*DHX:Depend map.js*/
dhtmlx.chart = {};
/* DHX DEPEND FROM FILE 'ext/chart/chart_area.js'*/
dhtmlx.chart = {};
/* DHX DEPEND FROM FILE 'ext/chart/chart_area.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.area = {
/**
@@ -984,7 +984,7 @@ dhtmlx.chart.stackedArea ={
ctx.globalAlpha = this._settings.alpha.call(this,data[0]);
ctx.fillStyle = this._settings.color.call(this,data[0]);
/*for the 2nd, 3rd, etc. series*/
var y01 = (sIndex?data[0].$startY:point1.y);
@@ -1037,12 +1037,12 @@ dhtmlx.chart.stackedArea ={
}
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_spline.js'*/
/* DHX DEPEND FROM FILE 'ext/chart/chart_spline.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.spline = {
/**
@@ -1129,12 +1129,12 @@ dhtmlx.chart.spline = {
_getSplineYPoint:function(x,xi,i,a,b,c,d){
return a[i] + (x - xi)*(b[i] + (x-xi)*(c[i]+(x-xi)*d[i]));
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_barh.js'*/
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_barh.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.barH = {
/**
@@ -1388,12 +1388,12 @@ dhtmlx.chart.barH = {
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_stackedbarh.js'*/
/* DHX DEPEND FROM FILE 'ext/chart/chart_stackedbarh.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
/*DHX:Depend ext/chart/chart_barh.js*/
@@ -1487,7 +1487,7 @@ dhtmlx.chart.stackedBarH = {
/*for the 2nd, 3rd, etc. series*/
if(sIndex)
x0 = data[i].$startX;
x0 = data[i].$startX || x0;
if(value<0||(this._settings.yAxis&&value===0)){
this.renderTextAt(true, true, x0+Math.floor(barWidth/2),y0,this._settings.label(data[i]));
@@ -1538,12 +1538,12 @@ dhtmlx.chart.stackedBarH = {
data[i].$startX = points[0];
}
}
}
/* DHX DEPEND FROM FILE 'ext/chart/chart_stackedbar.js'*/
}
/* DHX DEPEND FROM FILE 'ext/chart/chart_stackedbar.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.stackedBar = {
/**
@@ -1622,8 +1622,8 @@ dhtmlx.chart.stackedBar = {
/*for the 2nd, 3rd, etc. series*/
if(sIndex)
y0 = data[i].$startY;
y0 = data[i].$startY || y0;
/*the max height limit*/
if(y0 < (point0.y+1)) continue;
@@ -1711,12 +1711,12 @@ dhtmlx.chart.stackedBar = {
return [x5,y3-2*offset];
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_line.js'*/
/* DHX DEPEND FROM FILE 'ext/chart/chart_line.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.line = {
@@ -1865,12 +1865,12 @@ dhtmlx.chart.line = {
return params;
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_bar.js'*/
/* DHX DEPEND FROM FILE 'ext/chart/chart_bar.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.bar = {
/**
@@ -2099,12 +2099,12 @@ dhtmlx.chart.bar = {
// ctx.lineTo(x0,0); //IE fix!
return [x5,y3];
}
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_pie.js'*/
};
/* DHX DEPEND FROM FILE 'ext/chart/chart_pie.js'*/
/*DHX:Depend ext/chart/chart_base.js*/
dhtmlx.chart.pie = {
pvt_render_pie:function(ctx,data,x,y,sIndex,map){
@@ -2395,12 +2395,12 @@ dhtmlx.chart.pie3D = {
pvt_render_pie3D:function(ctx,data,x,y,sIndex,map){
this._renderPie(ctx,data,x,y,this._settings.cant,map);
}
}
/* DHX DEPEND FROM FILE 'template.js'*/
}
/* DHX DEPEND FROM FILE 'template.js'*/
/*
Template - handles html templates
*/
@@ -2509,12 +2509,12 @@ dhtmlx.Type={
}
}
};
/* DHX DEPEND FROM FILE 'single_render.js'*/
/* DHX DEPEND FROM FILE 'single_render.js'*/
/*
REnders single item.
Can be used for elements without datastore, or with complex custom rendering logic
@@ -2544,12 +2544,12 @@ dhtmlx.SingleRender={
if (this.callEvent) this.callEvent("onAfterRender",[]);
}
}
};
/* DHX DEPEND FROM FILE 'tooltip.js'*/
};
/* DHX DEPEND FROM FILE 'tooltip.js'*/
/*
UI: Tooltip
@@ -2617,12 +2617,12 @@ dhtmlx.ui.Tooltip.prototype = {
template_item_start:dhtmlx.Template.empty,
template_item_end:dhtmlx.Template.empty
};
/* DHX DEPEND FROM FILE 'autotooltip.js'*/
/* DHX DEPEND FROM FILE 'autotooltip.js'*/
/*
Behavior: AutoTooltip - links tooltip to data driven item
*/
@@ -2643,12 +2643,12 @@ dhtmlx.AutoTooltip = {
});
return t;
}
};
/* DHX DEPEND FROM FILE 'datastore.js'*/
};
/* DHX DEPEND FROM FILE 'datastore.js'*/
/*DHX:Depend dhtmlx.js*/
/*
@@ -3057,12 +3057,12 @@ dhtmlx.sort = {
return method(a,b)*-1;
};
}
};
/* DHX DEPEND FROM FILE 'group.js'*/
};
/* DHX DEPEND FROM FILE 'group.js'*/
/*DHX:Depend datastore.js*/
/*DHX:Depend dhtmlx.js*/
@@ -3187,12 +3187,12 @@ dhtmlx.Group = {
});
return config;
}
};
/* DHX DEPEND FROM FILE 'key.js'*/
};
/* DHX DEPEND FROM FILE 'key.js'*/
/*
Behavior:KeyEvents - hears keyboard
*/
@@ -3207,12 +3207,12 @@ dhtmlx.KeyEvents = {
var code = e.which||e.keyCode; //FIXME better solution is required
this.callEvent((this._edit_id?"onEditKeyPress":"onKeyPress"),[code,e.ctrlKey,e.shiftKey,e]);
}
};
/* DHX DEPEND FROM FILE 'mouse.js'*/
};
/* DHX DEPEND FROM FILE 'mouse.js'*/
/*
Behavior:MouseEvents - provides inner evnets for mouse actions
*/
@@ -3306,12 +3306,12 @@ dhtmlx.MouseEvents={
}
return found; //returns true if item was located and event was triggered
}
};
/* DHX DEPEND FROM FILE 'config.js'*/
};
/* DHX DEPEND FROM FILE 'config.js'*/
/*
Behavior:Settings
@@ -3431,12 +3431,12 @@ dhtmlx.Settings={
this._obj.className += " "+value;
return value;
}
};
/* DHX DEPEND FROM FILE 'compatibility.js'*/
};
/* DHX DEPEND FROM FILE 'compatibility.js'*/
/*
Collection of compatibility hacks
*/
@@ -3512,12 +3512,12 @@ dhtmlx.compat=function(name, obj){
};
}
})();
/* DHX DEPEND FROM FILE 'compatibility_layout.js'*/
})();
/* DHX DEPEND FROM FILE 'compatibility_layout.js'*/
/*DHX:Depend dhtmlx.js*/
/*DHX:Depend compatibility.js*/
@@ -3558,12 +3558,12 @@ dhtmlx.attaches.attachChart = function(conf){
};
dhtmlx.compat.layout = function(){};
/* DHX DEPEND FROM FILE 'load.js'*/
/* DHX DEPEND FROM FILE 'load.js'*/
/*
ajax operations
@@ -3965,12 +3965,12 @@ dhtmlx.DataDriver.xml={
}
};
/* DHX DEPEND FROM FILE 'compatibility_grid.js'*/
/* DHX DEPEND FROM FILE 'compatibility_grid.js'*/
/*
Compatibility hack for loading data from the grid.
Provides new type of datasource - dhtmlxgrid
@@ -4001,12 +4001,12 @@ dhtmlx.DataDriver.dhtmlxgrid={
_from:0
};
}
};
/* DHX DEPEND FROM FILE 'canvas.js'*/
};
/* DHX DEPEND FROM FILE 'canvas.js'*/
/*DHX:Depend thirdparty\excanvas*/
/*DHX:Depend dhtmlx.js*/
@@ -4080,12 +4080,12 @@ dhtmlx.Canvas = {
//FF breaks, when we are using clear canvas and call clearRect without parameters
this.getCanvas().clearRect(0,0,this._canvas.offsetWidth, this._canvas.offsetHeight);
}
};
/* DHX INITIAL FILE 'D:\dev\xampp\htdocs\temp\chart\dhtmlxCore/sources//chart.js'*/
};
/* DHX INITIAL FILE 'D:\dev\xampp\htdocs\temp\chart\dhtmlxCore/sources//chart.js'*/
/*DHX:Depend chart.css*/
/*DHX:Depend canvas.js*/
/*DHX:Depend load.js*/
@@ -4734,4 +4734,4 @@ dhtmlXChart.prototype={
}
};
dhtmlx.compat("layout");
dhtmlx.compat("layout");
+5 -5
View File
@@ -14,7 +14,7 @@ var COLOR_PALETTE = [
QWeb.add_template('/base_graph/static/src/xml/base_graph.xml');
openerp.base.views.add('graph', 'openerp.base_graph.GraphView');
openerp.base_graph.GraphView = openerp.base.Controller.extend({
openerp.base_graph.GraphView = openerp.base.View.extend({
init: function(view_manager, session, element_id, dataset, view_id) {
this._super(session, element_id);
@@ -31,7 +31,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
this.$element.hide();
},
start: function() {
this.rpc("/base_graph/graphview/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded);
return this.rpc("/base_graph/graphview/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded);
},
on_loaded: function(data) {
this.all_fields = data.all_fields;
@@ -270,7 +270,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
y_axis = ordinate_description;
}
var bar_chart = new dhtmlxchartChart({
var bar_chart = new dhtmlXChart({
view: view_chart,
container: self.elem_id+"-barchart",
value:"#"+group_list[0]+"#",
@@ -337,14 +337,14 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
},
schedule_pie: function(result) {
var self = this;
var chart = new dhtmlxchartChart({
var chart = new dhtmlXChart({
view:"pie3D",
container:self.elem_id+"-piechart",
value:"#"+self.operator_field+"#",
pieInnerText:function(obj) {
var sum = chart.sum("#"+self.operator_field+"#");
var val = obj[self.operator_field] / sum * 100 ;
return Math.round(val * 10)/10 + "%";
return val.toFixed(1) + "%";
},
gradient:"3d",
height: 20,
+76
View File
@@ -110,6 +110,79 @@ initializing the addon.
});
}
Creating new standard roles
---------------------------
Views
+++++
Views are the standard high-level component in OpenERP. A view type corresponds
to a way to display a set of data (coming from an OpenERP model).
In OpenERP Web, views are standard objects registered against a dedicated
object registry, so the :js:class:`~openerp.base.ViewManager` knows where to
find and how to call them.
Although not mandatory, it is recommended that views inherit from
:js:class:`openerp.base.View`, which provides a view useful services to its
children.
Registering a view
~~~~~~~~~~~~~~~~~~
This is the first task to perform when creating a view, and the simplest by
far: simply call ``openerp.base.views.add(name, object_path)`` to register
the object of path ``object_path`` as the view for the view name ``name``.
The view name is the name you gave to your new view in the OpenERP server.
From that point onwards, OpenERP Web will be able to find your object and
instantiate it.
Standard view behaviors
~~~~~~~~~~~~~~~~~~~~~~~
In the normal OpenERP Web flow, views have to implement a number of methods so
view managers can correctly communicate with them:
``start()``
This method will always be called after creating the view (via its
constructor), but not necessarily immediately.
It is called with no arguments and should handle the heavy setup work,
including remote call (to load the view's setup data from the server via
e.g. ``fields_view_get``, for instance).
``start`` should return a `promise object`_ which *must* be resolved when
the view's setup is completed. This promise is used by view managers to
know when they can start interacting with the view.
``do_hide()``
Called by the view manager when it wants to replace this view by an other
one, but wants to keep this view around to re-activate it later.
Should put the view in some sort of hibernation mode, and *must* hide its
DOM elements.
``do_show()``
Called when the view manager wants to re-display the view after having
hidden it. The view should refresh its data display upon receiving this
notification
``do_search(domains: Array, contexts: Array, groupbys: Array)``
If the view is searchable, this method is called to notify it of a search
against it.
It should use the provided query data to perform a search and refresh its
internal content (and display).
All views are searchable by default, but they can be made non-searchable
by setting the property ``searchable`` to ``false``.
This can be done either on the view class itself (at the same level as
defining e.g. the ``start`` method) or at the instance level (in the
class's ``init``), though you should generally set it on the class.
Utility behaviors
-----------------
@@ -423,3 +496,6 @@ Python
.. _nose:
http://somethingaboutorange.com/mrl/projects/nose/1.0.0/
.. _promise object:
http://api.jquery.com/deferred.promise/