Merge lp:~therp-nl/openerp-web/6.1-lp1048643-record_is_undefined into lp:openerp-web/6.1

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openerp-web/6.1-lp1048643-record_is_undefined
Merge into: lp:openerp-web/6.1
Diff against target: 59 lines (+17/-3)
3 files modified
addons/web/static/src/js/core.js (+9/-0)
addons/web/static/src/js/view_list.js (+4/-3)
addons/web/static/src/js/views.js (+4/-0)
To merge this branch: bzr merge lp:~therp-nl/openerp-web/6.1-lp1048643-record_is_undefined
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) Approve
OpenERP Core Team Pending
Review via email: mp+123560@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) :
review: Approve

Unmerged revisions

2456. By Holger Brunn (Therp)

[ADD] function openerp.web.callback.removeCode to remove anonymous
functions whose reference is not available
[FIX] update right row on subsequent calls to buttons which open a dialog

2455. By Xavier (Open ERP)

[MRG] backport http://bazaar.launchpad.net/~openerp/openerp-web/trunk/revision/2863.1.6

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/core.js'
2--- addons/web/static/src/js/core.js 2012-08-31 12:13:20 +0000
3+++ addons/web/static/src/js/core.js 2012-09-10 14:35:28 +0000
4@@ -172,6 +172,15 @@
5 return callback;
6 };
7
8+ //remove callbacks based on either exact reference or same code - convenient
9+ //when we're busy with anonymous functions
10+ callback.removeCode = function(f) {
11+ callback.callback_chain = _.difference(callback.callback_chain, _.filter(callback.callback_chain, function(el) {
12+ return el.callback === f || el.callback.toString() == f.toString();
13+ }));
14+ return callback;
15+ }
16+
17 return callback.add({
18 callback: method,
19 self:obj,
20
21=== modified file 'addons/web/static/src/js/view_list.js'
22--- addons/web/static/src/js/view_list.js 2012-06-25 07:20:46 +0000
23+++ addons/web/static/src/js/view_list.js 2012-09-10 14:35:28 +0000
24@@ -606,7 +606,8 @@
25 c.add(action.context);
26 }
27 action.context = c;
28- this.do_execute_action(action, this.dataset, id, callback);
29+ this.do_execute_action(
30+ action, this.dataset, id, _.bind(callback, null, id));
31 },
32 /**
33 * Handles the activation of a record (clicking on it)
34@@ -869,8 +870,8 @@
35 // of digits, nice when storing actual numbers, not nice when
36 // storing strings composed only of digits. Force the action
37 // name to be a string
38- $(self).trigger('action', [field.toString(), record_id, function () {
39- return self.reload_record(self.records.get(record_id));
40+ $(self).trigger('action', [field.toString(), record_id, function (id) {
41+ return self.reload_record(self.records.get(id));
42 }]);
43 })
44 .delegate('a', 'click', function (e) {
45
46=== modified file 'addons/web/static/src/js/views.js'
47--- addons/web/static/src/js/views.js 2012-06-29 10:53:25 +0000
48+++ addons/web/static/src/js/views.js 2012-09-10 14:35:28 +0000
49@@ -144,6 +144,10 @@
50 this.dialog.on_close.add(on_close);
51 } else {
52 this.dialog_viewmanager.stop();
53+ if(on_close) {
54+ this.dialog.on_close.removeCode(on_close);
55+ this.dialog.on_close.add(on_close);
56+ }
57 }
58 this.dialog.dialog_title = action.name;
59 this.dialog_viewmanager = new session.web.ViewManagerAction(this, action);