Merge lp:~camptocamp/geospatial-addons/fix-widget-early-get-value-20121218 into lp:~geospatial-addons-core-editors/geospatial-addons/6.1

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 86
Proposed branch: lp:~camptocamp/geospatial-addons/fix-widget-early-get-value-20121218
Merge into: lp:~geospatial-addons-core-editors/geospatial-addons/6.1
Diff against target: 15 lines (+4/-1)
1 file modified
base_geoengine/static/src/js/geoengine_view.js (+4/-1)
To merge this branch: bzr merge lp:~camptocamp/geospatial-addons/fix-widget-early-get-value-20121218
Reviewer Review Type Date Requested Status
Nicolas Bessi - Camptocamp (community) Approve
Review via email: mp+140425@code.launchpad.net

Description of the change

Make sure we don't call too early the get_value of a widget inserted after a geoengine widget geo_edit_map

To post a comment you must log in.
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Well, I'm not sure this is the best way to do it. But effectively I do not see any other way to fix this without patching the web client.

That's odd as start function should be called only when all widget are loaded. At that time it is not problematic because the context it is not really used yet. But that's a workaround that should be reverted when date widget/web client is fixed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_geoengine/static/src/js/geoengine_view.js'
2--- base_geoengine/static/src/js/geoengine_view.js 2012-12-12 15:44:48 +0000
3+++ base_geoengine/static/src/js/geoengine_view.js 2012-12-18 13:08:11 +0000
4@@ -600,7 +600,10 @@
5 return;
6 }
7 var self = this;
8- var rdataset = new openerp.web.DataSetStatic(self, self.view.model, self.build_context());
9+ // We blacklist all other fields in order to avoid calling get_value inside the build_context on field widget which aren't started yet
10+ var blacklist = this.view.fields_order.slice();
11+ delete blacklist[this.name];
12+ var rdataset = new openerp.web.DataSetStatic(self, self.view.model, self.build_context(blacklist));
13 rdataset.call("get_edit_info_for_geo_column", [self.name, rdataset.get_context()], false, 0).then(function(result) {
14 var layers = self.create_edit_layers(self, result);
15 self.geo_type = result.geo_type;

Subscribers

People subscribed via source and target branches