Merge lp:~camptocamp/ocb-web/7.0-ContextGroupByPropagationIssue-1101840 into lp:ocb-web

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 4128
Proposed branch: lp:~camptocamp/ocb-web/7.0-ContextGroupByPropagationIssue-1101840
Merge into: lp:ocb-web
Diff against target: 59 lines (+36/-2)
1 file modified
addons/web/static/src/js/views.js (+36/-2)
To merge this branch: bzr merge lp:~camptocamp/ocb-web/7.0-ContextGroupByPropagationIssue-1101840
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
arthru (community) Approve
Alexis de Lattre (community) tests only Approve
Pedro Manuel Baeza code review Approve
Nicolas Bessi - Camptocamp (community) no test, code review Approve
Review via email: mp+198582@code.launchpad.net

Commit message

[FIX] Web: Refixed the issue of context propagation, also removed the view references of current dataset.

Description of the change

Mirroring: https://code.launchpad.net/~openerp-dev/openerp-web/7.0-opw-601491ContextGroupByPropagationIssue-msh

Fixes: lp:1101840

Already fixed in trunk.

Author: Mohammed Shekha(OpenERP) <email address hidden>

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

Thanks for the MP

LGTM

review: Approve (no test, code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM, same as official patch.

Regards.

review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for backporting this!

review: Approve (test)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Just to say that the upstream patch has become a little more elaborate in the mean time. I'll 'abstain' until I can test that solution, at least against the issue reported in the bug thread https://bugs.launchpad.net/ocb-web/+bug/1101840/comments/7

review: Abstain
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Just to say that the upstream patch has become a little more elaborate in the
> mean time. I'll 'abstain' until I can test that solution, at least against the
> issue reported in the bug thread https://bugs.launchpad.net/ocb-
> web/+bug/1101840/comments/7

The upstream patch also got a fix for another bug: https://bugs.launchpad.net/openerp-web/+bug/1263888
I'm testing it and will update this branch.

4097. By Guewen Baconnier @ Camptocamp

[MRG] from lp:ocb-web/7.0

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I tested the upstream patch which worked well.
I updated this branch from the upstream.

4098. By Mohammed Shekha(OpenERP)<email address hidden>

[MRG] keep in sync with the upstream branch: lp:~openerp-dev/openerp-web/7.0-opw-601491ContextGroupByPropagationIssue-msh

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

I tested the new version of the fix and I confirm that it does not have the regression from the first version while still fixing the related bug.

However, this OCB backport still also contains the first version of the OPW in ll.2-15. In these lines, a context structure is composed but used nowhere. The lines can be safely removed.

review: Needs Fixing
4099. By Guewen Baconnier @ Camptocamp

remove the first version of the patch

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> I tested the new version of the fix and I confirm that it does not have the
> regression from the first version while still fixing the related bug.
>
> However, this OCB backport still also contains the first version of the OPW in
> ll.2-15. In these lines, a context structure is composed but used nowhere. The
> lines can be safely removed.

Thanks! I removed these lines

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I confirm that this MP solves the bug "Crash when clicking on "Split in Serial Numbers" https://bugs.launchpad.net/ocb-addons/+bug/1271139

So this patch is now in production :)

review: Approve (tests only)
Revision history for this message
arthru (arthru) wrote :

Just tested : it works !

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks Guewen. Approved and merged.

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Reverted this change here: http://bazaar.launchpad.net/~ocb/ocb-web/7.0/revision/4189, because the upstream fix http://bazaar.launchpad.net/~ocb/ocb-web/7.0/revision/4190, while equivalent, is slightly different (takes advantage of existing underscore API instead of copying it in with the fix).

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 2013-09-14 12:53:36 +0000
3+++ addons/web/static/src/js/views.js 2014-01-21 12:24:25 +0000
4@@ -1358,12 +1358,21 @@
5 var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {});
6 var handler = function (action) {
7 if (action && action.constructor == Object) {
8- var ncontext = new instance.web.CompoundContext(context);
9+ // filter out context keys that are specific to the action model.
10+ // Wrong default_ and search_default values will no give the expected views
11+ // Wrong group_by values will simply fail and forbid rendering of the destination view
12+ var view_refs = _(action.views).map(function(view){return view[1] + '_view_ref';}).join('|');
13+ var ncontext = new instance.web.CompoundContext(
14+ self.object(_.reject(self.pairs(dataset.get_context().eval()), function(pair) {
15+ return pair[0].match('^(?:(?:default_|search_default_)|(?:'+view_refs+')|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
16+ }))
17+ );
18+ ncontext.add(action_data.context || {});
19+ ncontext.add({active_model: dataset.model});
20 if (record_id) {
21 ncontext.add({
22 active_id: record_id,
23 active_ids: [record_id],
24- active_model: dataset.model
25 });
26 }
27 ncontext.add(action.context || {});
28@@ -1407,6 +1416,31 @@
29 return dataset.exec_workflow(record_id, action_data.name).then(handler);
30 }
31 },
32+ // Convert an object into a list of `[key, value]` pairs.
33+ pairs: function(obj) {
34+ var keys = _.keys(obj);
35+ var length = keys.length;
36+ var pairs = new Array(length);
37+ for (var i = 0; i < length; i++) {
38+ pairs[i] = [keys[i], obj[keys[i]]];
39+ }
40+ return pairs;
41+ },
42+ // Converts lists into objects. Pass either a single array of `[key, value]`
43+ // pairs, or two parallel arrays of the same length -- one of keys, and one of
44+ // the corresponding values.
45+ object: function(list, values) {
46+ if (list == null) return {};
47+ var result = {};
48+ for (var i = 0, length = list.length; i < length; i++) {
49+ if (values) {
50+ result[list[i]] = values[i];
51+ } else {
52+ result[list[i][0]] = list[i][1];
53+ }
54+ }
55+ return result;
56+ },
57 /**
58 * Directly set a view to use instead of calling fields_view_get. This method must
59 * be called before start(). When an embedded view is set, underlying implementations

Subscribers

People subscribed via source and target branches