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

Proposed by Holger Brunn (Therp)
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~therp-nl/openerp-web/7.0-lp1048643-record_is_undefined
Merge into: lp:openerp-web
Diff against target: 34 lines (+13/-0)
2 files modified
addons/web/static/src/js/corelib.js (+9/-0)
addons/web/static/src/js/views.js (+4/-0)
To merge this branch: bzr merge lp:~therp-nl/openerp-web/7.0-lp1048643-record_is_undefined
Reviewer Review Type Date Requested Status
Antony Lesuisse (OpenERP) Needs Fixing
Review via email: mp+123562@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

The callbackenable mixin will be removed for 7.0 in favor of trigger() on()

review: Needs Fixing
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

callbackenabled has been removed, so this fix doesn't apply anymore

Unmerged revisions

3041. By Holger Brunn (Therp)

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

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/corelib.js'
2--- addons/web/static/src/js/corelib.js 2012-09-06 10:38:52 +0000
3+++ addons/web/static/src/js/corelib.js 2012-09-10 14:46:23 +0000
4@@ -459,6 +459,15 @@
5 return callback;
6 };
7
8+ //remove callbacks based on either exact reference or same code
9+ //convenient 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/views.js'
22--- addons/web/static/src/js/views.js 2012-09-06 15:14:43 +0000
23+++ addons/web/static/src/js/views.js 2012-09-10 14:46:23 +0000
24@@ -293,6 +293,10 @@
25 this.dialog.on_close.add(on_close);
26 } else {
27 this.dialog_widget.destroy();
28+ if(on_close) {
29+ this.dialog.on_close.removeCode(on_close);
30+ this.dialog.on_close.add(on_close);
31+ }
32 }
33 this.dialog.dialog_title = action.name;
34 this.dialog_widget = widget;