Bhumi Thakkar (Open ERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-improve-graph-bth into 
lp:~openerp-dev/openerp-web/trunk-task-improve-dashboard.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-improve-graph-bth/+merge/123885

Hello,

When change type of graph or when there is no record in graph at that time got 
errpr 

Uncaught TypeError: Cannot read property '1' of undefined
http://localhost:8069/web/webclient/js:3721
    
TypeError: _.min(record.data, function (item) {return item[1];}) is undefined   
          
http://localhost:8069/web/webclient/js?mods=web_diagram,web_mobile,web_graph,web_view_editor,web_calendar,web_tests,web_gantt,base,web_kanban,base_setup,process,mail,board,crm:1031

Check records length and then pass first index if exist.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-improve-graph-bth/+merge/123885
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openerp-web/trunk-improve-graph-bth into 
lp:~openerp-dev/openerp-web/trunk-task-improve-dashboard.
=== modified file 'addons/web_graph/static/src/js/graph.js'
--- addons/web_graph/static/src/js/graph.js	2012-08-24 18:27:07 +0000
+++ addons/web_graph/static/src/js/graph.js	2012-09-12 05:52:19 +0000
@@ -142,9 +142,11 @@
     options_bar: function (data) {
         var min = _(data.data).chain()
             .map(function (record) {
-                return _.min(record.data, function (item) {
-                    return item[1];
-                })[1];
+                if (record.data.length > 0){
+	                return _.min(record.data, function (item) {
+	                    return item[1];
+	                })[1];
+                }
             }).min().value();
         return {
             bars : {

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to