Nicolas Vanhoren (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-core-extraction-1-niv into lp:openerp-web.

Requested reviews:
  Antony Lesuisse (OpenERP) (al-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-core-extraction-1-niv/+merge/94021

First part of the extraction of the core into an independent lib.

Basically, I just extracted the "parented" mixin. I had to create some now 
methods and rename old ones for it to be clean.

Please note the fact that the stop method does not mirror the start method any 
more can be explained. The destroy method is part of ParentedMixin and the 
start method is part of Widget, so there is no need for ParentedMixin to be 
consistent with Widget since it does not depend of Widget.

The documentation will be done in a later merge proposal.

Note that it is necessary to merge 
lp:~openerp-dev/openobject-addons/trunk-core-extraction-1-niv at the same time.
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-core-extraction-1-niv/+merge/94021
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-core-extraction-1-niv.
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js	2012-02-17 11:43:57 +0000
+++ addons/web/static/src/js/chrome.js	2012-02-21 16:55:25 +0000
@@ -148,7 +148,7 @@
     on_resized: function() {
         //openerp.log("Dialog resized to %d x %d", this.$element.width(), this.$element.height());
     },
-    stop: function () {
+    destroy: function () {
         // Destroy widget
         this.close();
         this.$element.dialog('destroy');
@@ -240,7 +240,7 @@
         this.session.on_rpc_request.add_first(this.request_call);
         this.session.on_rpc_response.add_last(this.response_call);
     },
-    stop: function() {
+    destroy: function() {
         this.session.on_rpc_request.remove(this.request_call);
         this.session.on_rpc_response.remove(this.response_call);
         this.on_rpc_event(-this.count);
@@ -261,7 +261,7 @@
             $(".loading",this.$element).text(_.str.sprintf(
                 _t("Loading (%d)"), this.count));
             $(".loading",this.$element).show();
-            this.widget_parent.$element.addClass('loading');
+            this.getParent().$element.addClass('loading');
         } else {
             this.count = 0;
             clearTimeout(this.long_running_timer);
@@ -271,7 +271,7 @@
                 $.unblockUI();
             }
             $(".loading",this.$element).fadeOut();
-            this.widget_parent.$element.removeClass('loading');
+            this.getParent().$element.removeClass('loading');
         }
     }
 });
@@ -318,7 +318,7 @@
             self.hide();
         });
     },
-    stop: function () {
+    destroy: function () {
         this.hide();
         this.$option_id.empty();
 
@@ -381,9 +381,9 @@
 
             var admin = result[1][0];
             setTimeout(function () {
-                self.widget_parent.do_login(
+                self.getParent().do_login(
                         info.db, admin.login, admin.password);
-                self.stop();
+                self.destroy();
                 self.unblockUI();
             });
         });
@@ -437,7 +437,7 @@
                     if (self.db_list) {
                         self.db_list.push(self.to_object(fields)['db_name']);
                         self.db_list.sort();
-                        self.widget_parent.set_db_list(self.db_list);
+                        self.getParent().set_db_list(self.db_list);
                     }
                     var form_obj = self.to_object(fields);
                     self.wait_for_newdb(result, {
@@ -469,7 +469,7 @@
                     $db_list.find(':selected').remove();
                     if (self.db_list) {
                         self.db_list.splice(_.indexOf(self.db_list, db, true), 1);
-                        self.widget_parent.set_db_list(self.db_list);
+                        self.getParent().set_db_list(self.db_list);
                     }
                     self.do_notify("Dropping database", "The database '" + db + "' has been dropped");
                 });
@@ -799,7 +799,7 @@
                         var inner_viewmanager = action_manager.inner_viewmanager;
                         inner_viewmanager.views[inner_viewmanager.active_view].controller.do_save()
                         .then(function() {
-                            self.dialog.stop();
+                            self.dialog.destroy();
                             // needs to refresh interface in case language changed
                             window.location.reload();
                         });
@@ -1101,7 +1101,7 @@
             self.header.do_update();
             self.menu.do_reload();
             if(self.action_manager)
-                self.action_manager.stop();
+                self.action_manager.destroy();
             self.action_manager = new openerp.web.ActionManager(self);
             self.action_manager.appendTo($("#oe_app"));
             self.bind_hashchange();
@@ -1152,8 +1152,8 @@
         this.loading.appendTo(this.$element);
     },
     destroy_content: function() {
-        _.each(_.clone(this.widget_children), function(el) {
-            el.stop();
+        _.each(_.clone(this.getChildren()), function(el) {
+            el.destroy();
         });
         this.$element.children().remove();
     },

=== modified file 'addons/web/static/src/js/core.js'
--- addons/web/static/src/js/core.js	2012-02-17 10:17:31 +0000
+++ addons/web/static/src/js/core.js	2012-02-21 16:55:25 +0000
@@ -925,6 +925,40 @@
     }
 });
 
+openerp.web.ParentedMixin = {
+    __parented_mixin: true,
+    setParent: function(parent) {
+        if(this.getParent()) {
+            if (this.getParent().__parented_mixin) {
+                this.getParent().__parented_children = _.without(this.getParent().getChildren(), this);
+            }
+            this.__parented_parent = undefined;
+        }
+        this.__parented_parent = parent;
+        if(parent && parent.__parented_mixin) {
+            if (!parent.getChildren())
+                parent.__parented_children = [];
+            parent.getChildren().push(this);
+        }
+    },
+    getParent: function() {
+        return this.__parented_parent;
+    },
+    getChildren: function() {
+        return this.__parented_children ? _.clone(this.__parented_children) : [];
+    },
+    isDestroyed: function() {
+        return this.__parented_stopped;
+    },
+    destroy: function() {
+        _.each(this.getChildren(), function(el) {
+            el.destroy();
+        });
+        this.setParent(undefined);
+        this.__parented_stopped = true;
+    },
+};
+
 /**
  * Base class for all visual components. Provides a lot of functionalities helpful
  * for the management of a part of the DOM.
@@ -969,11 +1003,11 @@
  *
  * And of course, when you don't need that widget anymore, just do:
  *
- * my_widget.stop();
+ * my_widget.destroy();
  *
  * That will kill the widget in a clean way and erase its content from the dom.
  */
-openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.Widget# */{
+openerp.web.Widget = openerp.web.CallbackEnabled.extend(openerp.web.ParentedMixin).extend(/** @lends openerp.web.Widget# */{
     /**
      * The name of the QWeb template that will be used for rendering. Must be
      * redefined in subclasses or the default render() method can not be used.
@@ -993,7 +1027,7 @@
      * @extends openerp.web.CallbackEnabled
      *
      * @param {openerp.web.Widget} parent Binds the current instance to the given Widget instance.
-     * When that widget is destroyed by calling stop(), the current instance will be
+     * When that widget is destroyed by calling destroy(), the current instance will be
      * destroyed too. Can be null.
      * @param {String} element_id Deprecated. Sets the element_id. Only useful when you want
      * to bind the current Widget to an already existing part of the DOM, which is not compatible
@@ -1006,13 +1040,19 @@
         
         this.$element = $(document.createElement(this.tag_name));
 
-        this.widget_parent = parent;
-        this.widget_children = [];
-        if(parent && parent.widget_children) {
-            parent.widget_children.push(this);
+        this.setParent(parent);
+    },
+    /**
+     * Destroys the current widget, also destroys all its children before destroying itself.
+     */
+    destroy: function() {
+        _.each(_.clone(this.getChildren()), function(el) {
+            el.destroy();
+        });
+        if(this.$element != null) {
+            this.$element.remove();
         }
-        // useful to know if the widget was destroyed and should not be used anymore
-        this.widget_is_stopped = false;
+        this._super();
     },
     /**
      * Renders the current widget and appends it to the given jQuery object or Widget.
@@ -1105,41 +1145,25 @@
         return $.Deferred().done().promise();
     },
     /**
-     * Destroys the current widget, also destroys all its children before destroying itself.
-     */
-    stop: function() {
-        _.each(_.clone(this.widget_children), function(el) {
-            el.stop();
-        });
-        if(this.$element != null) {
-            this.$element.remove();
-        }
-        if (this.widget_parent && this.widget_parent.widget_children) {
-            this.widget_parent.widget_children = _.without(this.widget_parent.widget_children, this);
-        }
-        this.widget_parent = null;
-        this.widget_is_stopped = true;
-    },
-    /**
      * Informs the action manager to do an action. This supposes that
      * the action manager can be found amongst the ancestors of the current widget.
      * If that's not the case this method will simply return `false`.
      */
     do_action: function(action, on_finished) {
-        if (this.widget_parent) {
-            return this.widget_parent.do_action(action, on_finished);
+        if (this.getParent()) {
+            return this.getParent().do_action(action, on_finished);
         }
         return false;
     },
     do_notify: function() {
-        if (this.widget_parent) {
-            return this.widget_parent.do_notify.apply(this,arguments);
+        if (this.getParent()) {
+            return this.getParent().do_notify.apply(this,arguments);
         }
         return false;
     },
     do_warn: function() {
-        if (this.widget_parent) {
-            return this.widget_parent.do_warn.apply(this,arguments);
+        if (this.getParent()) {
+            return this.getParent().do_warn.apply(this,arguments);
         }
         return false;
     },
@@ -1148,10 +1172,10 @@
         var def = $.Deferred().then(success, error);
         var self = this;
         openerp.connection.rpc(url, data). then(function() {
-            if (!self.widget_is_stopped)
+            if (!self.isDestroyed())
                 def.resolve.apply(def, arguments);
         }, function() {
-            if (!self.widget_is_stopped)
+            if (!self.isDestroyed())
                 def.reject.apply(def, arguments);
         });
         return def.promise();

=== modified file 'addons/web/static/src/js/data_import.js'
--- addons/web/static/src/js/data_import.js	2012-02-17 11:43:57 +0000
+++ addons/web/static/src/js/data_import.js	2012-02-21 16:55:25 +0000
@@ -66,11 +66,11 @@
         this._super();
         this.open({
             buttons: [
-                {text: _t("Close"), click: function() { self.stop(); }},
+                {text: _t("Close"), click: function() { self.destroy(); }},
                 {text: _t("Import File"), click: function() { self.do_import(); }, 'class': 'oe-dialog-import-button'}
             ],
             close: function(event, ui) {
-                self.stop();
+                self.destroy();
             }
         });
         this.toggle_import_button(false);
@@ -201,10 +201,10 @@
             return;
         }
         if (results['success']) {
-            if (this.widget_parent.widget_parent.active_view == "list") {
-                this.widget_parent.reload_content();
+            if (this.getParent().getParent().active_view == "list") {
+                this.getParent().reload_content();
             }
-            this.stop();
+            this.destroy();
             return;
         }
 
@@ -358,7 +358,7 @@
         }
         return true;
     },
-    stop: function() {
+    destroy: function() {
         this.$element.remove();
         this._super();
     }

=== modified file 'addons/web/static/src/js/search.js'
--- addons/web/static/src/js/search.js	2012-02-17 11:43:57 +0000
+++ addons/web/static/src/js/search.js	2012-02-21 16:55:25 +0000
@@ -303,10 +303,10 @@
                     });
                     self.rpc('/web/searchview/add_to_dashboard', {
                         menu_id: menu_id,
-                        action_id: self.widget_parent.action.id,
+                        action_id: self.getParent().action.id,
                         context_to_save: context,
                         domain: domain,
-                        view_mode: self.widget_parent.active_view,
+                        view_mode: self.getParent().active_view,
                         name: title
                     }, function(r) {
                         if (r === false) {
@@ -552,7 +552,7 @@
      * "Stops" the widgets. Called when the view destroys itself, this
      * lets the widgets clean up after themselves.
      */
-    stop: function () {
+    destroy: function () {
         delete this.view;
         this._super();
     },
@@ -1114,7 +1114,7 @@
         if(this.$element.closest("table.oe-searchview-render-line").css("display") == "none") {
             return null;
         }
-        return _.reduce(this.widget_children,
+        return _.reduce(this.getChildren(),
             function(mem, x) { return mem.concat(x.get_domain());}, []);
     },
     on_activate: function() {
@@ -1133,9 +1133,9 @@
         }
     },
     check_last_element: function() {
-        _.each(this.widget_children, function(x) {x.set_last_group(false);});
-        if (this.widget_children.length >= 1) {
-            this.widget_children[this.widget_children.length - 1].set_last_group(true);
+        _.each(this.getChildren(), function(x) {x.set_last_group(false);});
+        if (this.getChildren().length >= 1) {
+            this.getChildren()[this.getChildren().length - 1].set_last_group(true);
         }
     }
 });
@@ -1148,7 +1148,7 @@
     },
     add_prop: function() {
         var prop = new openerp.web.search.ExtendedSearchProposition(this, this.fields);
-        var render = prop.render({'index': this.widget_children.length - 1});
+        var render = prop.render({'index': this.getChildren().length - 1});
         this.$element.find('.searchview_extended_propositions_list').append(render);
         prop.start();
     },
@@ -1159,11 +1159,11 @@
             _this.add_prop();
         });
         this.$element.find('.searchview_extended_delete_group').click(function () {
-            _this.stop();
+            _this.destroy();
         });
     },
     get_domain: function() {
-        var props = _(this.widget_children).chain().map(function(x) {
+        var props = _(this.getChildren()).chain().map(function(x) {
             return x.get_proposition();
         }).compact().value();
         var choice = this.$element.find(".searchview_extended_group_choice").val();
@@ -1172,10 +1172,10 @@
             _.map(_.range(_.max([0,props.length - 1])), function() { return op; }),
             props);
     },
-    stop: function() {
-        var parent = this.widget_parent;
-        if (this.widget_parent.widget_children.length == 1)
-            this.widget_parent.hide();
+    destroy: function() {
+        var parent = this.getParent();
+        if (this.getParent().getChildren().length == 1)
+            this.getParent().hide();
         this._super();
         parent.check_last_element();
     },
@@ -1210,16 +1210,16 @@
             _this.changed();
         });
         this.$element.find('.searchview_extended_delete_prop').click(function () {
-            _this.stop();
+            _this.destroy();
         });
     },
-    stop: function() {
+    destroy: function() {
         var parent;
-        if (this.widget_parent.widget_children.length == 1)
-            parent = this.widget_parent;
+        if (this.getParent().getChildren().length == 1)
+            parent = this.getParent();
         this._super();
         if (parent)
-            parent.stop();
+            parent.destroy();
     },
     changed: function() {
         var nval = this.$element.find(".searchview_extended_prop_field").val();
@@ -1235,7 +1235,7 @@
     select_field: function(field) {
         var self = this;
         if(this.attrs.selected != null) {
-            this.value.stop();
+            this.value.destroy();
             this.value = null;
             this.$element.find('.searchview_extended_prop_op').html('');
         }

=== modified file 'addons/web/static/src/js/view_editor.js'
--- addons/web/static/src/js/view_editor.js	2012-02-13 10:53:41 +0000
+++ addons/web/static/src/js/view_editor.js	2012-02-21 16:55:25 +0000
@@ -1002,10 +1002,10 @@
         $.when(action_manager.do_action(action)).then(function() {
             var controller = action_manager.dialog_viewmanager.views['form'].controller;
             controller.on_button_cancel.add_last(function(){
-                action_manager.stop()
+                action_manager.destroy()
             });
             controller.do_save.add_last(function(){
-                action_manager.stop();
+                action_manager.destroy();
                 var value =controller.fields.name.value;
                 self.add_node_dialog.$element.find('select[id=field_value]').append($("<option selected></option>").attr("value",value).text(value));
                     _.detect(self.add_widget,function(widget){

=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js	2012-02-21 09:58:56 +0000
+++ addons/web/static/src/js/view_form.js	2012-02-21 16:55:25 +0000
@@ -74,13 +74,13 @@
                 }, this.on_loaded);
         }
     },
-    stop: function() {
+    destroy: function() {
         if (this.sidebar) {
-            this.sidebar.attachments.stop();
-            this.sidebar.stop();
+            this.sidebar.attachments.destroy();
+            this.sidebar.destroy();
         }
         _.each(this.widgets, function(w) {
-            w.stop();
+            w.destroy();
         });
         this._super();
     },
@@ -923,7 +923,7 @@
 
         this.width = this.node.attrs.width;
     },
-    stop: function() {
+    destroy: function() {
         this._super.apply(this, arguments);
         $.fn.tipsy.clear();
     },
@@ -2554,7 +2554,7 @@
             this.previous_readonly = this.readonly;
             if (this.viewmanager) {
                 this.is_loaded = this.is_loaded.pipe(function() {
-                    self.viewmanager.stop();
+                    self.viewmanager.destroy();
                     return $.when(self.load_views()).then(function() {
                         self.reload_current_view();
                     });
@@ -2734,7 +2734,7 @@
             this.previous_readonly = this.readonly;
             if (this.list_view) {
                 this.is_loaded = this.is_loaded.pipe(function() {
-                    self.list_view.stop();
+                    self.list_view.destroy();
                     return $.when(self.load_view()).then(function() {
                         self.reload_content();
                     });
@@ -2782,7 +2782,7 @@
         var pop = new openerp.web.form.FormOpenPopup(this);
         pop.show_element(this.dataset.model, id, this.m2m_field.build_context(), {
             title: _t("Open: ") + this.name,
-            readonly: this.widget_parent.is_readonly()
+            readonly: this.getParent().is_readonly()
         });
         pop.on_write_completed.add_last(function() {
             self.reload_content();
@@ -2866,7 +2866,7 @@
     setup_search_view: function(search_defaults) {
         var self = this;
         if (this.searchview) {
-            this.searchview.stop();
+            this.searchview.destroy();
         }
         this.searchview = new openerp.web.SearchView(this,
                 this.dataset, false,  search_defaults);
@@ -2896,7 +2896,7 @@
                 $buttons.prepend(QWeb.render("SelectCreatePopup.search.buttons"));
                 var $cbutton = $buttons.find(".oe_selectcreatepopup-search-close");
                 $cbutton.click(function() {
-                    self.stop();
+                    self.destroy();
                 });
                 var $sbutton = $buttons.find(".oe_selectcreatepopup-search-select");
                 if(self.options.disable_multiple_selection) {
@@ -2904,7 +2904,7 @@
                 }
                 $sbutton.click(function() {
                     self.on_select_elements(self.selected_ids);
-                    self.stop();
+                    self.destroy();
                 });
             });
         });
@@ -2988,7 +2988,7 @@
         if (this.created_elements.length > 0) {
             this.on_select_elements(this.created_elements);
         }
-        this.stop();
+        this.destroy();
     },
     on_default_get: function(res) {}
 });
@@ -2999,7 +2999,7 @@
     },
     select_record: function(index) {
         this.popup.on_select_elements([this.dataset.ids[index]]);
-        this.popup.stop();
+        this.popup.destroy();
     },
     do_select: function(ids, records) {
         this._super(ids, records);
@@ -3075,12 +3075,12 @@
             var $nbutton = $buttons.find(".oe_formopenpopup-form-save");
             $nbutton.click(function() {
                 self.view_form.do_save().then(function() {
-                    self.stop();
+                    self.destroy();
                 });
             });
             var $cbutton = $buttons.find(".oe_formopenpopup-form-close");
             $cbutton.click(function() {
-                self.stop();
+                self.destroy();
             });
             if (self.options.readonly) {
                 $nbutton.hide();

=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js	2012-02-09 17:07:48 +0000
+++ addons/web/static/src/js/view_list.js	2012-02-21 16:55:25 +0000
@@ -96,7 +96,7 @@
         if (this._limit === undefined) {
             this._limit = (this.options.limit
                         || this.defaults.limit
-                        || (this.widget_parent.action || {}).limit
+                        || (this.getParent().action || {}).limit
                         || 80);
         }
         return this._limit;

=== modified file 'addons/web/static/src/js/view_list_editable.js'
--- addons/web/static/src/js/view_list_editable.js	2012-02-21 10:15:22 +0000
+++ addons/web/static/src/js/view_list_editable.js	2012-02-21 16:55:25 +0000
@@ -139,7 +139,7 @@
             }
             cancelled.then(function () {
                 self.view.unpad_columns();
-                self.edition_form.stop();
+                self.edition_form.destroy();
                 self.edition_form.$element.remove();
                 delete self.edition_form;
                 delete self.edition_id;
@@ -237,21 +237,14 @@
                 self.edition_id = record_id;
                 self.edition_form = new openerp.web.ListEditableFormView(self.view, self.dataset, false);
                 self.edition_form.$element = $new_row;
+                self.edition_form.editable_list = self;
                 // HO HO
                 // empty
                 $.when(self.edition_form.on_loaded(self.get_form_fields_view())).then(function () {
                     // put in $.when just in case  FormView.on_loaded becomes asynchronous
                     $new_row.find('> td')
-                          .addClass('oe-field-cell')
-                          .removeAttr('width')
                       .end()
                       .find('td:last').removeClass('oe-field-cell').end();
-                    if (self.options.selectable) {
-                        $new_row.prepend('<th>');
-                    }
-                    if (self.options.isClarkGable) {
-                        $new_row.prepend('<th>');
-                    }
                     // pad in case of groupby
                     _(self.columns).each(function (column) {
                         if (column.meta) {

=== modified file 'addons/web/static/src/js/views.js'
--- addons/web/static/src/js/views.js	2012-02-17 11:43:57 +0000
+++ addons/web/static/src/js/views.js	2012-02-21 16:55:25 +0000
@@ -30,31 +30,31 @@
     },
     dialog_stop: function () {
         if (this.dialog) {
-            this.dialog_viewmanager.stop();
+            this.dialog_viewmanager.destroy();
             this.dialog_viewmanager = null;
-            this.dialog.stop();
+            this.dialog.destroy();
             this.dialog = null;
         }
     },
     content_stop: function () {
         if (this.inner_viewmanager) {
-            this.inner_viewmanager.stop();
+            this.inner_viewmanager.destroy();
             this.inner_viewmanager = null;
         }
         if (this.client_widget) {
-            this.client_widget.stop();
+            this.client_widget.destroy();
             this.client_widget = null;
         }
     },
     do_push_state: function(state) {
-        if (this.widget_parent && this.widget_parent.do_push_state) {
+        if (this.getParent() && this.getParent().do_push_state) {
             if (this.inner_action) {
                 state['model'] = this.inner_action.res_model;
                 if (this.inner_action.id) {
                     state['action_id'] = this.inner_action.id;
                 }
             }
-            this.widget_parent.do_push_state(state);
+            this.getParent().do_push_state(state);
         }
     },
     do_load_state: function(state, warm) {
@@ -142,7 +142,7 @@
                 if(on_close)
                     this.dialog.on_close.add(on_close);
             } else {
-                this.dialog_viewmanager.stop();
+                this.dialog_viewmanager.destroy();
             }
             this.dialog.dialog_title = action.name;
             this.dialog_viewmanager = new session.web.ViewManagerAction(this, action);
@@ -150,7 +150,7 @@
             this.dialog.open();
         } else  {
             if(action.menu_id) {
-                return this.widget_parent.do_action(action, function () {
+                return this.getParent().do_action(action, function () {
                     session.webclient.menu.open_menu(action.menu_id);
                 });
             }
@@ -209,7 +209,7 @@
         window.open(action.url, action.target === 'self' ? '_self' : '_blank');
     },
     ir_ui_menu: function (action) {
-        this.widget_parent.do_action(action);
+        this.getParent().do_action(action);
     }
 });
 
@@ -385,7 +385,7 @@
     setup_search_view: function(view_id, search_defaults) {
         var self = this;
         if (this.searchview) {
-            this.searchview.stop();
+            this.searchview.destroy();
         }
         this.searchview = new session.web.SearchView(
                 this, this.dataset,
@@ -680,9 +680,9 @@
         });
     },
     do_push_state: function(state) {
-        if (this.widget_parent && this.widget_parent.do_push_state) {
+        if (this.getParent() && this.getParent().do_push_state) {
             state["view_type"] = this.active_view;
-            this.widget_parent.do_push_state(state);
+            this.getParent().do_push_state(state);
         }
     },
     do_load_state: function(state, warm) {
@@ -702,7 +702,7 @@
     },
     shortcut_check : function(view) {
         var self = this;
-        var grandparent = this.widget_parent && this.widget_parent.widget_parent;
+        var grandparent = this.getParent() && this.getParent().getParent();
         // display shortcuts if on the first view for the action
         var $shortcut_toggle = this.$element.find('.oe-shortcut-toggle');
         if (!this.action.name ||
@@ -796,8 +796,8 @@
     },
     add_default_sections: function() {
         var self = this,
-            view = this.widget_parent,
-            view_manager = view.widget_parent,
+            view = this.getParent(),
+            view_manager = view.getParent(),
             action = view_manager.action;
         if (this.session.uid === 1) {
             this.add_section(_t('Customize'), 'customize');
@@ -912,8 +912,8 @@
     },
     on_item_action_clicked: function(item) {
         var self = this;
-        self.widget_parent.sidebar_context().then(function (context) {
-            var ids = self.widget_parent.get_selected_ids();
+        self.getParent().sidebar_context().then(function (context) {
+            var ids = self.getParent().get_selected_ids();
             if (ids.length == 0) {
                 //TODO: make prettier warning?
             	openerp.web.dialog($("<div />").text(_t("You must choose at least one record.")), {
@@ -925,7 +925,7 @@
             var additional_context = _.extend({
                 active_id: ids[0],
                 active_ids: ids,
-                active_model: self.widget_parent.dataset.model
+                active_model: self.getParent().dataset.model
             }, context);
             self.rpc("/web/action/load", {
                 action_id: item.action.id,
@@ -937,7 +937,7 @@
                 result.result.flags.new_window = true;
                 self.do_action(result.result, function () {
                     // reload view
-                    self.widget_parent.reload();
+                    self.getParent().reload();
                 });
             });
         });
@@ -1111,8 +1111,8 @@
         var self = this;
         var result_handler = function () {
             if (on_closed) { on_closed.apply(null, arguments); }
-            if (self.widget_parent && self.widget_parent.on_action_executed) {
-                return self.widget_parent.on_action_executed.apply(null, arguments);
+            if (self.getParent() && self.getParent().on_action_executed) {
+                return self.getParent().on_action_executed.apply(null, arguments);
             }
         };
         var context = new session.web.CompoundContext(dataset.get_context(), action_data.context || {});
@@ -1184,8 +1184,8 @@
         this.$element.hide();
     },
     do_push_state: function(state) {
-        if (this.widget_parent && this.widget_parent.do_push_state) {
-            this.widget_parent.do_push_state(state);
+        if (this.getParent() && this.getParent().do_push_state) {
+            this.getParent().do_push_state(state);
         }
     },
     do_load_state: function(state, warm) {

=== modified file 'addons/web/static/src/xml/base.xml'
--- addons/web/static/src/xml/base.xml	2012-02-21 09:58:56 +0000
+++ addons/web/static/src/xml/base.xml	2012-02-21 16:55:25 +0000
@@ -728,6 +728,8 @@
     </td>
 </tr>
 <t t-name="ListView.row.form">
+    <th t-if="widget.editable_list.options.selectable"></th>
+    <th t-if="widget.editable_list.options.isClarkGable"></th>
 </t>
 
 <t t-name="FormView">
@@ -1522,9 +1524,8 @@
     <t t-foreach="widget.table" t-as="row">
         <t t-foreach="row" t-as="td">
             <td t-att-colspan="td.colspan gt 1 ? td.colspan : undefined"
-                t-att-width="td.width"
                 t-att-valign="td.table ? 'top' : undefined"
-                t-attf-class="oe_form_frame_cell #{td.classname} #{td.element_class}"
+                t-attf-class="oe_form_frame_cell #{td.classname} #{td.element_class} oe-field-cell"
             >
                 <t t-raw="td.render()"/>
             </td>

=== modified file 'addons/web_calendar/static/src/js/calendar.js'
--- addons/web_calendar/static/src/js/calendar.js	2012-02-08 13:20:15 +0000
+++ addons/web_calendar/static/src/js/calendar.js	2012-02-21 16:55:25 +0000
@@ -42,7 +42,7 @@
         this._super();
         return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': true}, this.on_loaded);
     },
-    stop: function() {
+    destroy: function() {
         scheduler.clearAll();
         this._super();
     },

=== modified file 'addons/web_dashboard/static/src/js/dashboard.js'
--- addons/web_dashboard/static/src/js/dashboard.js	2012-02-21 08:55:45 +0000
+++ addons/web_dashboard/static/src/js/dashboard.js	2012-02-21 16:55:25 +0000
@@ -238,9 +238,9 @@
         this.$element.html(rendered);
     },
     do_reload: function() {
-        var view_manager = this.view.widget_parent,
-            action_manager = view_manager.widget_parent;
-        this.view.stop();
+        var view_manager = this.view.getParent(),
+            action_manager = view_manager.getParent();
+        this.view.destroy();
         action_manager.do_action(view_manager.action);
     }
 });
@@ -341,7 +341,7 @@
                 });
             })
             .delegate('li:not(.oe-done)', 'click', function () {
-                self.widget_parent.widget_parent.widget_parent.do_execute_action({
+                self.getParent().getParent().getParent().do_execute_action({
                         type: 'object',
                         name: 'action_launch'
                     }, self.dataset,
@@ -463,8 +463,8 @@
         });
         return r;
     },
-    stop: function() {
-        this.action_manager.stop();
+    destroy: function() {
+        this.action_manager.destroy();
         return this._super();
     }
 });

=== modified file 'addons/web_graph/static/src/js/graph.js'
--- addons/web_graph/static/src/js/graph.js	2012-02-16 08:42:37 +0000
+++ addons/web_graph/static/src/js/graph.js	2012-02-21 16:55:25 +0000
@@ -33,7 +33,7 @@
 
         this.renderer = null;
     },
-    stop: function () {
+    destroy: function () {
         if (this.renderer) {
             clearTimeout(this.renderer);
         }
@@ -97,7 +97,7 @@
         this.$element.html(QWeb.render("GraphView", {
             "fields_view": this.fields_view,
             "chart": this.chart,
-            'element_id': this.widget_parent.element_id
+            'element_id': this.getParent().element_id
         }));
 
         var fields = _(this.columns).pluck('name').concat([this.abscissa]);
@@ -272,7 +272,7 @@
             self.renderer = null;
             var charts = new dhtmlXChart({
                 view: view_chart,
-                container: self.widget_parent.element_id+"-"+self.chart+"chart",
+                container: self.getParent().element_id+"-"+self.chart+"chart",
                 value:"#"+group_list[0].group+"#",
                 gradient: (self.chart == "bar") ? "3d" : "light",
                 alpha: (self.chart == "area") ? 0.6 : 1,
@@ -309,8 +309,8 @@
                     }
                 }
             });
-            self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").width(
-                self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").width()+120);
+            self.$element.find("#"+self.getParent().element_id+"-"+self.chart+"chart").width(
+                self.$element.find("#"+self.getParent().element_id+"-"+self.chart+"chart").width()+120);
 
             for (var m = 1; m<group_list.length;m++){
                 var column = group_list[m];
@@ -333,8 +333,8 @@
                 });
             }
             charts.parse(results, "json");
-            self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").height(
-                self.$element.find("#"+self.widget_parent.element_id+"-"+self.chart+"chart").height()+50);
+            self.$element.find("#"+self.getParent().element_id+"-"+self.chart+"chart").height(
+                self.$element.find("#"+self.getParent().element_id+"-"+self.chart+"chart").height()+50);
             charts.attachEvent("onItemClick", function(id) {
                 self.open_list_view(charts.get(id));
             });
@@ -354,7 +354,7 @@
             self.renderer = null;
             var chart =  new dhtmlXChart({
                 view:"pie3D",
-                container:self.widget_parent.element_id+"-piechart",
+                container:self.getParent().element_id+"-piechart",
                 value:"#"+self.ordinate+"#",
                 pieInnerText:function(obj) {
                     var sum = chart.sum("#"+self.ordinate+"#");
@@ -406,8 +406,8 @@
         }
 
         var views;
-        if (this.widget_parent.action) {
-            views = this.widget_parent.action.views;
+        if (this.getParent().action) {
+            views = this.getParent().action.views;
             if (!_(views).detect(function (view) {
                     return view[1] === 'list' })) {
                 views = [[false, 'list']].concat(views);

=== modified file 'addons/web_kanban/static/src/js/kanban.js'
--- addons/web_kanban/static/src/js/kanban.js	2012-02-13 17:20:38 +0000
+++ addons/web_kanban/static/src/js/kanban.js	2012-02-21 16:55:25 +0000
@@ -176,7 +176,7 @@
     },
     do_clear_groups: function() {
         _.each(this.groups, function(group) {
-            group.stop();
+            group.destroy();
         });
         this.groups = [];
         this.$element.find('.oe_kanban_groups_headers, .oe_kanban_groups_records').empty();
@@ -327,7 +327,7 @@
         this.$has_been_started.resolve();
         return def;
     },
-    stop: function() {
+    destroy: function() {
         this._super();
         if (this.$records) {
             this.$records.remove();
@@ -469,7 +469,7 @@
         if (confirm(_t("Are you sure you want to delete this record ?"))) {
             return $.when(this.view.dataset.unlink([this.id])).then(function() {
                 self.group.remove_record(self.id);
-                self.stop();
+                self.destroy();
             });
         }
     },
@@ -520,7 +520,7 @@
                 self.set_record(records[0]);
                 self.do_render();
             } else {
-                self.stop();
+                self.destroy();
             }
         });
     },

=== modified file 'addons/web_process/static/src/js/process.js'
--- addons/web_process/static/src/js/process.js	2012-01-31 10:58:46 +0000
+++ addons/web_process/static/src/js/process.js	2012-02-21 16:55:25 +0000
@@ -12,7 +12,7 @@
         },
         process_check: function() {
             var self = this,
-            grandparent = this.widget_parent && this.widget_parent.widget_parent,
+            grandparent = this.getParent() && this.getParent().getParent(),
             view = this.views[this.views_src[0].view_type],
             $process_view = this.$element.find('.oe-process-view');
             if (!(grandparent instanceof openerp.web.WebClient) ||
@@ -128,7 +128,7 @@
             this.$element.find('#edit_process').click(function() {
                 self.edit_process_view();
             });
-            var $parent = this.widget_parent.$element;
+            var $parent = this.getParent().$element;
             $parent.find('#change_process').click(function() {
                 self.process_selection = false,
                 self.process_id = $parent.find('#select_process').val(),

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to