diff options
| author | Bhumi Thakkar (Open ERP) <bth@tinyerp.com> | 2011-08-16 11:05:52 +0530 |
|---|---|---|
| committer | Bhumi Thakkar (Open ERP) <bth@tinyerp.com> | 2011-08-16 11:05:52 +0530 |
| commit | 08cf0f2fb08a5d3af57a0aa77e73b5fb9da028e7 (patch) | |
| tree | d2758d340d58bd655dc6362d7cab82d68399805a /addons/base/static/src/js | |
| parent | 28ffaba5ab94e5d28cd2c81c0518a998257074de (diff) | |
| parent | a4f9eb398b39978be8c35a8eb2e1eb561ef26ecf (diff) | |
[MERGE] Merge trunk in mobile-client.
bzr revid: bth@tinyerp.com-20110816053552-e36jsh9h7hvyzhes
Diffstat (limited to 'addons/base/static/src/js')
| -rw-r--r-- | addons/base/static/src/js/core.js | 53 | ||||
| -rw-r--r-- | addons/base/static/src/js/formats.js | 2 | ||||
| -rw-r--r-- | addons/base/static/src/js/list.js | 4 | ||||
| -rw-r--r-- | addons/base/static/src/js/search.js | 15 |
4 files changed, 8 insertions, 66 deletions
diff --git a/addons/base/static/src/js/core.js b/addons/base/static/src/js/core.js index 859c96645a1..da9b5abf3e8 100644 --- a/addons/base/static/src/js/core.js +++ b/addons/base/static/src/js/core.js @@ -373,59 +373,6 @@ openerp.base.SessionAware = openerp.base.Class.extend({ } }); -/** - * Base class for all visual components. Provides a lot of functionalities helpful - * for the management of a part of the DOM. - * - * Widget handles: - * - Rendering with QWeb. - * - Life-cycle management and parenting (when a parent is destroyed, all its children are - * destroyed too). - * - Insertion in DOM. - * - * Widget also extends SessionAware for ease of use. - * - * Guide to create implementations of the Widget class: - * ============================================== - * - * Here is a sample child class: - * - * MyWidget = openerp.base.Widget.extend({ - * // the name of the QWeb template to use for rendering - * template: "MyQWebTemplate", - * // identifier prefix, it is useful to put an obvious one for debugging - * identifier_prefix: 'my-id-prefix-', - * - * init: function(parent) { - * this._super(parent); - * // stuff that you want to init before the rendering - * }, - * start: function() { - * this._super(); - * // stuff you want to make after the rendering, `this.$element` holds a correct value - * this.$element.find(".my_button").click(/* an example of event binding * /); - * - * // if you have some asynchronous operations, it's a good idea to return - * // a promise in start() - * var promise = this.rpc(...); - * return promise; - * } - * }); - * - * Now this class can simply be used with the following syntax: - * - * var my_widget = new MyWidget(this); - * my_widget.appendTo($(".some-div")); - * - * With these two lines, the MyWidget instance was inited, rendered, it was inserted into the - * DOM inside the ".some-div" div and its events were binded. - * - * And of course, when you don't need that widget anymore, just do: - * - * my_widget.stop(); - * - * That will kill the widget in a clean way and erase its content from the dom. - */ openerp.base.Widget = openerp.base.SessionAware.extend({ /** * The name of the QWeb template that will be used for rendering. Must be diff --git a/addons/base/static/src/js/formats.js b/addons/base/static/src/js/formats.js index fb1ada544a4..074cabe5eee 100644 --- a/addons/base/static/src/js/formats.js +++ b/addons/base/static/src/js/formats.js @@ -83,7 +83,7 @@ openerp.base.parse_time = function(str) { */ var zpad = function(str, size) { str = "" + str; - return new Array(size - str.length).join('0') + str; + return new Array(size - str.length + 1).join('0') + str; }; /** diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js index 3032e702a73..a0440221520 100644 --- a/addons/base/static/src/js/list.js +++ b/addons/base/static/src/js/list.js @@ -772,7 +772,7 @@ openerp.base.ListView.List = openerp.base.Class.extend( /** @lends openerp.base. var old_index = this.dataset.index; this.dataset.index = record_index; read_p = this.dataset.read_index( - _.filter(_.pluck(this.columns, 'name'), _.identity), + _.pluck(_(this.columns).filter(function (r) {return r.tag === 'field';}), 'name'), function (record) { var form_record = self.transform_record(record); self.rows.splice(record_index, 1, form_record); @@ -1035,7 +1035,7 @@ openerp.base.ListView.Groups = openerp.base.Class.extend( /** @lends openerp.bas page = this.datagroup.openable ? this.page : view.page; dataset.read_slice({ - fields: _.filter(_.pluck(_.select(this.columns, function(x) {return x.tag == "field";}), 'name'), _.identity), + fields: _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name'), offset: page * limit, limit: limit }, function (records) { diff --git a/addons/base/static/src/js/search.js b/addons/base/static/src/js/search.js index 4b746832a65..63ccec088a6 100644 --- a/addons/base/static/src/js/search.js +++ b/addons/base/static/src/js/search.js @@ -875,11 +875,10 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({ this._super(); var _this = this; this.add_prop(); - this.$element.find('.searchview_extended_add_proposition').click(function (e) { + this.$element.find('.searchview_extended_add_proposition').click(function () { _this.add_prop(); }); - var delete_btn = this.$element.find('.searchview_extended_delete_group'); - delete_btn.click(function (e) { + this.$element.find('.searchview_extended_delete_group').click(function () { _this.stop(); }); }, @@ -889,7 +888,7 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({ }).compact().value(); var choice = this.$element.find(".searchview_extended_group_choice").val(); var op = choice == "all" ? "&" : "|"; - return [].concat(choice == "none" ? ['!'] : [], + return choice == "none" ? ['!'] : [].concat( _.map(_.range(_.max([0,props.length - 1])), function() { return op; }), props); }, @@ -901,10 +900,7 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({ parent.check_last_element(); }, set_last_group: function(is_last) { - if(is_last) - this.$element.addClass("last_group"); - else - this.$element.removeClass("last_group"); + this.$element.toggleClass('last_group', is_last); } }); @@ -927,8 +923,7 @@ openerp.base.search.ExtendedSearchProposition = openerp.base.OldWidget.extend({ this.$element.find(".searchview_extended_prop_field").change(function() { _this.changed(); }); - var delete_btn = this.$element.find('.searchview_extended_delete_prop'); - delete_btn.click(function (e) { + this.$element.find('.searchview_extended_delete_prop').click(function () { _this.stop(); }); }, |
