Merge lp:~openerp-dev/openerp-web/6.1-opw-574625-bth into lp:openerp-web/6.1

Proposed by Bhumi Thakkar (Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-574625-bth
Merge into: lp:openerp-web/6.1
Diff against target: 61 lines (+6/-5)
2 files modified
addons/web/static/src/js/views.js (+3/-3)
addons/web_graph/static/src/js/graph.js (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-574625-bth
Reviewer Review Type Date Requested Status
Bhumi Thakkar (Open ERP) (community) Needs Resubmitting
Xavier (Open ERP) (community) Disapprove
Review via email: mp+109993@code.launchpad.net

Description of the change

Hello,

Using browser's back button to navigate back to a opportunities screen in graph or list view results in error.

1. Go to Sales => Opportunities,
2. Open in Graph View or List View.
3. Select any other menu
4. Click on the browser's back button.

Observed: Error is coming in dialog box: "Cannot read property 'view_id' of undefined"
Extected: "Open in Graph View or List View"

put condition if fields_view do not get from controller then return false;
if fields_view get then view_id get from fields_view.

Thanks.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

1. This is not the place at which the code blows up.
2. This is not a fix, it just bails out on an earlier piece of code's error, why is `fields_view` undefined at this point?

review: Disapprove
2361. By Bhumi Thakkar (Open ERP)

[FIX] set value of fields_view when view is loaded.

Revision history for this message
Bhumi Thakkar (Open ERP) (bth-openerp) wrote :

> 1. This is not the place at which the code blows up.
> 2. This is not a fix, it just bails out on an earlier piece of code's error,
> why is `fields_view` undefined at this point?

I have modified code to set value of fields_view.set value of fields_view when view is loaded.

review: Needs Resubmitting

Unmerged revisions

2361. By Bhumi Thakkar (Open ERP)

[FIX] set value of fields_view when view is loaded.

2360. By Bhumi Thakkar (Open ERP)

[FIX] Put condition before using object.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/views.js'
2--- addons/web/static/src/js/views.js 2012-06-12 14:19:43 +0000
3+++ addons/web/static/src/js/views.js 2012-06-25 10:52:19 +0000
4@@ -661,7 +661,7 @@
5 self.shortcut_check(self.views[view_type]);
6
7 self.$element.find('.oe-view-manager-logs:first').addClass('oe-folded').removeClass('oe-has-more').css('display','none').find('ul').empty();
8-
9+ if(!self.views[self.active_view].controller.fields_view) return false;
10 var controller = self.views[self.active_view].controller,
11 fvg = controller.fields_view,
12 view_id = (fvg && fvg.view_id) || '--';
13@@ -699,7 +699,7 @@
14 return self.on_mode_switch(state.view_type, true);
15 })
16 );
17- }
18+ }
19
20 $.when(defs).then(function() {
21 self.views[self.active_view].controller.do_load_state(state, warm);
22@@ -1200,7 +1200,7 @@
23 *
24 * @param {String} view view type to switch to
25 */
26- do_switch_view: function(view) {
27+ do_switch_view: function(view) {
28 },
29 /**
30 * Cancels the switch to the current view, switches to the previous one
31
32=== modified file 'addons/web_graph/static/src/js/graph.js'
33--- addons/web_graph/static/src/js/graph.js 2012-06-08 12:36:39 +0000
34+++ addons/web_graph/static/src/js/graph.js 2012-06-25 10:52:19 +0000
35@@ -40,8 +40,8 @@
36 this._super();
37 },
38 start: function() {
39+ this._super();
40 var self = this;
41- this._super();
42 var loaded;
43 if (this.embedded_view) {
44 loaded = $.when([self.embedded_view]);
45@@ -50,6 +50,8 @@
46 model: this.dataset.model,
47 view_id: this.view_id,
48 view_type: 'graph'
49+ },function(res){
50+ self.fields_view = res;
51 });
52 }
53 return $.when(
54@@ -57,7 +59,6 @@
55 loaded)
56 .then(function (fields_result, view_result) {
57 self.fields = fields_result[0];
58- self.fields_view = view_result[0];
59 self.on_loaded(self.fields_view);
60 });
61 },