From f44f548f066e98d62b05ec762e46997d85a7a932 Mon Sep 17 00:00:00 2001 From: Vishmita Date: Tue, 9 Oct 2012 12:49:54 +0530 Subject: [PATCH 01/30] [IMP]replace callenabled for on_write bzr revid: vja@tinyerp.com-20121009071954-jojvmfs7cjuc0elg --- addons/web_diagram/static/src/js/diagram.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index 508aeb30563..35ce3277116 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -240,9 +240,9 @@ instance.web.DiagramView = instance.web.View.extend({ } ); - pop.on_write.add(function() { + pop.on('on_write_complete',self,function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); - }); + }); var form_fields = [self.parent_field]; var form_controller = pop.view_form; @@ -303,7 +303,7 @@ instance.web.DiagramView = instance.web.View.extend({ title: _t("Open: ") + title } ); - pop.on_write.add(function() { + pop.on('on_write_complete',self,function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); }, From 6454fd15904d430ea5c0038829f15b158f958b30 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Wed, 10 Oct 2012 18:53:49 +0530 Subject: [PATCH 02/30] [IMP] Remove add_last in on_search method bzr revid: ggh@tinyerp.com-20121010132349-n3gdg0jhtyjfufma --- addons/web/static/src/js/search.js | 4 +--- addons/web/static/src/js/view_form.js | 2 +- addons/web/static/src/js/views.js | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..b403dab95db 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -783,7 +783,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.on_invalid(search.errors); return; } - return this.on_search(search.domains, search.contexts, search.groupbys); + return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, /** * Triggered after the SearchView has collected all relevant domains and @@ -801,8 +801,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * @param {Array} contexts an array of literal contexts or context refs * @param {Array} groupbys ordered contexts which may or may not have group_by keys */ - on_search: function (domains, contexts, groupbys) { - }, /** * Triggered after a validation error in the SearchView fields. * diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 9315ce15d1a..0ee753ccb52 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4533,7 +4533,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend } this.searchview = new instance.web.SearchView(this, this.dataset, false, search_defaults); - this.searchview.on_search.add(function(domains, contexts, groupbys) { + this.searchview.on('data_search', self, function(domains, contexts, groupbys) { if (self.initial_ids) { self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]), contexts, groupbys); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f985e5f6dc8..a49bf96441f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -629,7 +629,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ } this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); - this.searchview.on_search.add(this.do_searchview_search); + this.searchview.on('data_search', self, this.do_searchview_search); return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search")); }, do_searchview_search: function(domains, contexts, groupbys) { From 1a476fed6919117c4f916a82b49b2162d7603338 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 11:09:07 +0530 Subject: [PATCH 03/30] [IMP] Remove add() in on_search method bzr revid: ggh@tinyerp.com-20121011053907-tykje6i145fmjrl3 --- addons/web/static/src/js/search.js | 16 ---------------- addons/web/static/test/search.js | 6 +++--- addons/web_hello/static/openerp/base_hello.js | 2 +- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index b403dab95db..6810cfd35fa 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -785,22 +785,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, - /** - * Triggered after the SearchView has collected all relevant domains and - * contexts. - * - * It is provided with an Array of domains and an Array of contexts, which - * may or may not be evaluated (each item can be either a valid domain or - * context, or a string to evaluate in order in the sequence) - * - * It is also passed an array of contexts used for group_by (they are in - * the correct order for group_by evaluation, which contexts may not be) - * - * @event - * @param {Array} domains an array of literal domains or domain references - * @param {Array} contexts an array of literal contexts or context refs - * @param {Array} groupbys ordered contexts which may or may not have group_by keys - */ /** * Triggered after a validation error in the SearchView fields. * diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js index 6dc37f31d08..7c6556da363 100644 --- a/addons/web/static/test/search.js +++ b/addons/web/static/test/search.js @@ -652,7 +652,7 @@ $(document).ready(function () { } }); var ds, cs, gs; - view.on_search.add(function (d, c, g) { + view.on('data_search', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -690,7 +690,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds, cs, gs; - view.on_search.add(function (d, c, g) { + view.on('data_search', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -718,7 +718,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds; - view.on_search.add(function (d) { ds = d; }); + view.on('data_search', this, function (d) { ds = d; }); view.appendTo($fix) .always(start) .fail(function (error) { ok(false, error.message); }) diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index a74b8ef8f2f..7bfbf7b78e8 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -7,7 +7,7 @@ openerp.web_hello = function(instance) { instance.web.SearchView = instance.web.SearchView.extend({ init:function() { this._super.apply(this,arguments); - this.on_search.add(function(){console.log('hello');}); + this.on('data_search', this, function(){console.log('hello');}); } }); From 4e33d693239fed16ae1b3b355b6c64c245f67f92 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 11:13:09 +0530 Subject: [PATCH 04/30] [IMP]Remove add() in on_search method bzr revid: ggh@tinyerp.com-20121011054309-1y2f54y735r6h9qh --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e0c9ac9b7fc..e6a4ace66c7 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1110,7 +1110,7 @@ openerp.mail = function(session) { var self = this; this.searchview = new session.web.SearchView(this, this.ds_msg, false, defaults || {}, hidden || false); return this.searchview.appendTo(this.$('.oe_view_manager_view_search')).then(function () { - self.searchview.on_search.add(self.do_searchview_search); + self.searchview.on('data_search', self, self.do_searchview_search); }); }, From 73c32663d6050563eb5fb18a2492a1f1d898d876 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 14:28:07 +0530 Subject: [PATCH 05/30] add on_search comment bzr revid: ggh@tinyerp.com-20121011085807-vmldw354xdbruj1s --- addons/web/static/src/js/search.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 6810cfd35fa..b403dab95db 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -785,6 +785,22 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, + /** + * Triggered after the SearchView has collected all relevant domains and + * contexts. + * + * It is provided with an Array of domains and an Array of contexts, which + * may or may not be evaluated (each item can be either a valid domain or + * context, or a string to evaluate in order in the sequence) + * + * It is also passed an array of contexts used for group_by (they are in + * the correct order for group_by evaluation, which contexts may not be) + * + * @event + * @param {Array} domains an array of literal domains or domain references + * @param {Array} contexts an array of literal contexts or context refs + * @param {Array} groupbys ordered contexts which may or may not have group_by keys + */ /** * Triggered after a validation error in the SearchView fields. * From a31de511b6d753e52a114f9c9b438c07c449e8c6 Mon Sep 17 00:00:00 2001 From: Vishmita Date: Thu, 11 Oct 2012 15:33:01 +0530 Subject: [PATCH 06/30] [FIX]change event name bzr revid: vja@tinyerp.com-20121011100301-nc4en7cn431zkgp6 --- addons/web_diagram/static/src/js/diagram.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index 1ee2e54cc3e..d5262604ef4 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -240,7 +240,7 @@ instance.web.DiagramView = instance.web.View.extend({ } ); - pop.on('on_write_complete', self, function() { + pop.on('write_completed', self, function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); @@ -304,7 +304,7 @@ instance.web.DiagramView = instance.web.View.extend({ title: _t("Open: ") + title } ); - pop.on('on_write_complete', self, function() { + pop.on('write_completed', self, function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); }, From 15974eb2e095238cb1016d832e97110fb7a6794d Mon Sep 17 00:00:00 2001 From: Vishmita Date: Fri, 12 Oct 2012 17:15:34 +0530 Subject: [PATCH 07/30] [IMP]replace callenabled for on_loaded bzr revid: vja@tinyerp.com-20121012114534-qx7y6dzmqkw7t7px --- addons/web/static/src/js/search.js | 2 +- addons/web/static/src/js/view_form.js | 12 ++++++------ addons/web/static/src/js/view_list.js | 1 + addons/web/static/src/js/views.js | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..400411937c4 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -671,7 +671,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'facet_for_defaults', this.defaults)).then(function () { self.query.reset(_(arguments).compact(), {preventSearch: true}); }); - + self.trigger("search_view_load"); return $.when(drawer_started, defaults_fetched) .then(function () { self.ready.resolve(); }) }, diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index afb5e258c0b..d21c2320783 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -211,7 +211,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM e.stopPropagation(); } }); - + this._super.apply(this, arguments); return $.when(); }, extract_qweb_template: function(fvg) { @@ -4078,7 +4078,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ } this.list_view.m2m_field = this; var loaded = $.Deferred(); - this.list_view.on_loaded.add_last(function() { + this.list_view.on("view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4203,7 +4203,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( } this.kanban_view.m2m = this; var loaded = $.Deferred(); - this.kanban_view.on_loaded.add_last(function() { + this.kanban_view.on("view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4427,7 +4427,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.view_form.set_embedded_view(this.options.alternative_form_view); } this.view_form.appendTo(this.$el.find(".oe_popup_form")); - this.view_form.on_loaded.add_last(function() { + this.view_form.on("view_loaded",self,function() { var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { multi_select: multi_select, @@ -4546,7 +4546,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys); } }); - this.searchview.on_loaded.add_last(function () { + this.searchview.on("search_view_load",self,function () { self.view_list = new instance.web.form.SelectCreateListView(self, self.dataset, false, _.extend({'deletable': false, @@ -4563,7 +4563,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }).pipe(function() { self.searchview.do_search(); }); - self.view_list.on_loaded.add_last(function() { + self.view_list.on("view_loaded",self,function() { self.$buttonpane.html(QWeb.render("SelectCreatePopup.search.buttons", {widget:self})); var $cbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-close"); $cbutton.click(function() { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 7457ca5ef67..08e7662c630 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -358,6 +358,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.sidebar.add_toolbar(this.fields_view.toolbar); this.sidebar.$el.hide(); } + this._super.apply(this, arguments); }, /** * Configures the ListView pager based on the provided dataset's information diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f985e5f6dc8..1d99ab31727 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1146,6 +1146,7 @@ instance.web.View = instance.web.Widget.extend({ * Must return a promise. */ on_loaded: function(fields_view_get) { + this.trigger("view_loaded"); }, set_default_options: function(options) { this.options = options || {}; From 5d5a8e85c223060262ce55073cf7d38db02870d4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 13:07:50 +0200 Subject: [PATCH 08/30] [FIX] group_by_no_leaf handling bzr revid: xmo@openerp.com-20121017110750-vrtx04b40e4kralm --- addons/web/static/src/js/data.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 77583899bf1..30a8b9862fc 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -120,6 +120,10 @@ instance.web.Query = instance.web.Class.extend({ if (_.isEmpty(grouping)) { return null; } var self = this; + + // FIXME: when pyeval is merged + var ctx = instance.session.test_eval_contexts( + [this._model.context(this._context)]); return this._model.call('read_group', { groupby: grouping, fields: _.uniq(grouping.concat(this._fields || [])), @@ -130,6 +134,8 @@ instance.web.Query = instance.web.Class.extend({ orderby: instance.web.serialize_sort(this._order_by) || false }).pipe(function (results) { return _(results).map(function (result) { + // FIX: querygroup initialization + _.defaults(result.__context, ctx); return new instance.web.QueryGroup( self._model.name, grouping[0], result); }); From fa1aafa97d0c085e097245ae721007ce0261bae7 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 13:58:45 +0200 Subject: [PATCH 09/30] [FIX] in-group pagination of list views bzr revid: xmo@openerp.com-20121017115845-9ch6icjjhrzycj84 --- addons/web/static/src/css/base.css | 4 +++- addons/web/static/src/css/base.sass | 2 ++ addons/web/static/src/js/view_list.js | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 8925c3a0964..e62a01b4870 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,7 +25,6 @@ display: none !important; } } - .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -2592,6 +2591,9 @@ min-width: 0 !important; max-width: none !important; } +.openerp .oe_list_group_name { + white-space: nowrap; +} .openerp .oe_form .oe_form_field_many2many > .oe_list .oe_list_pager_single_page { display: none; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index a1adfe67e75..2787535d3ab 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2049,6 +2049,8 @@ $sheet-max-width: 860px .oe_form_field_float,.oe_form_view_integer,&.oe_form_field_datetime,&.oe_form_field_date min-width: 0 !important max-width: none !important + .oe_list_group_name + white-space: nowrap // }}} // FormView.many2many {{{ .oe_form .oe_form_field_many2many > .oe_list diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index a6aa637f655..de7f157c96d 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1230,6 +1230,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we .replaceWith(self.render()); }); this.$row.children().last() + .addClass('oe_list_group_pagination') .append($prev) .append('') .append($next); @@ -1414,10 +1415,12 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we })) .end() .find('button[data-pager-action=previous]') - .attr('disabled', page === 0) + .css('visibility', + page === 0 ? 'hidden' : '') .end() .find('button[data-pager-action=next]') - .attr('disabled', page === pages - 1); + .css('visibility', + page === pages - 1 ? 'hidden' : ''); } } From 886767fbaa334a75f43d980eca1419a2801201bc Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 14:16:01 +0200 Subject: [PATCH 10/30] [FIX] listview indicator positioning: position relative is UB on table elements bzr revid: xmo@openerp.com-20121017121601-g3kmxqxvoi447mkp --- addons/web/static/src/css/base.css | 15 +++++++++------ addons/web/static/src/css/base.sass | 12 +++++++----- addons/web/static/src/xml/base.xml | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index e62a01b4870..ab2b2d25322 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2653,14 +2653,17 @@ background: #eeeeee; vertical-align: top; } -.openerp .oe_list_content > thead th { - position: relative; -} .openerp .oe_list_content td, .openerp .oe_list_content th { padding: 3px 6px; line-height: 18px; } -.openerp .oe_list_content th:after { +.openerp .oe_list_content th.oe_sortable, .openerp .oe_list_content th.oe_sortable div { + cursor: pointer; +} +.openerp .oe_list_content th.oe_sortable div { + position: relative; +} +.openerp .oe_list_content th.oe_sortable div:after { position: absolute; right: 6px; content: ""; @@ -2670,12 +2673,12 @@ border-color: black transparent; visibility: hidden; } -.openerp .oe_list_content th.sortup:after { +.openerp .oe_list_content th.sortup div:after { visibility: visible; filter: alpha(opacity=60); opacity: 0.6; } -.openerp .oe_list_content th.sortdown:after { +.openerp .oe_list_content th.sortdown div:after { border-bottom: none; border-left: 4px solid transparent; border-right: 4px solid transparent; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 2787535d3ab..ecbd02d7cab 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2100,12 +2100,14 @@ $sheet-max-width: 860px border-bottom: 2px solid #cacaca background: #eee vertical-align: top - th - position: relative td, th padding: 3px 6px line-height: 18px - th:after + th.oe_sortable, th.oe_sortable div + cursor: pointer + th.oe_sortable div + position: relative + th.oe_sortable div:after position: absolute right: 6px content: "" @@ -2114,10 +2116,10 @@ $sheet-max-width: 860px border-style: solid border-color: #000 transparent visibility: hidden - th.sortup:after + th.sortup div:after visibility: visible @include opacity(0.6) - th.sortdown:after + th.sortdown div:after border-bottom: none border-left: 4px solid transparent border-right: 4px solid transparent diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b031ee172e2..06603ad17a5 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -631,9 +631,9 @@ + t-attf-class="oe_list_header_#{column.widget or column.type} #{((options.sortable and column.tag !== 'button') ? 'oe_sortable' : null)}">
- +
From 8e54c76845dc4bc7bffaa971ed7a4070a00eee65 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 15:43:51 +0200 Subject: [PATCH 11/30] [FIX] fetching of table cells to match form inputs to Only fetch the table cells of the row being edited *after* having saved a pending edition. Otherwise, when re-editing the same record (e.g. click between buttons or on a readonly field), the cells are saved, the record is refreshed destroying the cells, and when trying to get the cell positions to position form fields correctly... the cells which don't exist anymore return 0, 0 as their position and nothing works correctly. bzr revid: xmo@openerp.com-20121017134351-lpmz27f1iemmsfoq --- addons/web/static/src/js/view_list_editable.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index cd6b018ea0d..3a3b06cbedf 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -190,10 +190,10 @@ openerp.web.list_editable = function (instance) { this.records.add(record, { at: this.prepends_on_create() ? 0 : null}); } - var $recordRow = this.groups.get_row_for(record); - var cells = this.get_cells_for($recordRow); return this.ensure_saved().pipe(function () { + var $recordRow = self.groups.get_row_for(record); + var cells = self.get_cells_for($recordRow); self.fields_for_resize.splice(0, self.fields_for_resize.length); return self.with_event('edit', { record: record.attributes, @@ -398,7 +398,6 @@ openerp.web.list_editable = function (instance) { setup_events: function () { var self = this; _.each(this.editor.form.fields, function(field, field_name) { - var field; var setting = false; var set_invisible = function() { if (!setting && field.get("effective_readonly")) { @@ -774,7 +773,7 @@ openerp.web.list_editable = function (instance) { return this._super.apply(this, arguments); } var record_id = $(event.currentTarget).data('id'); - this.view.start_edition( + return this.view.start_edition( record_id ? this.records.get(record_id) : null, { focus_field: $(event.target).data('field') }); From 47fbd98ff22e09c3a0e46916902990332161c2c1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 17 Oct 2012 17:59:20 +0200 Subject: [PATCH 12/30] [FIX] basic inputs (e.g. float) in editable list views having size hardcoded to 7em bzr revid: xmo@openerp.com-20121017155920-lwmzlwbfthfzhluj --- addons/web/static/src/css/base.css | 4 ++-- addons/web/static/src/css/base.sass | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ab2b2d25322..c75042068a9 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2579,10 +2579,10 @@ } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input { text-align: right; - width: 100%; + width: 100% !important; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime > span, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date > span { - width: 100%; + width: 100% !important; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master { width: 100% !important; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index ecbd02d7cab..20d4be619ed 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2040,10 +2040,10 @@ $sheet-max-width: 860px &.oe_form_field_float,&.oe_form_view_integer input text-align: right - width: 100% + width: 100% !important &.oe_form_field_datetime,&.oe_form_field_date > span - width: 100% + width: 100% !important input.oe_datepicker_master width: 100% !important .oe_form_field_float,.oe_form_view_integer,&.oe_form_field_datetime,&.oe_form_field_date From 0a23335aa731c8eef5bc5b90a6f2e765dd7fe52f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 18 Oct 2012 08:37:03 +0200 Subject: [PATCH 13/30] [IMP] when editing a row, hide the list cells overlaid by form fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * visibility: hidden on the cell itself hides the whole cell including background and borders, looks terrible * color: transparent is supported by all supported browsers (even IE >= 9), and it avoids breaking the cell sizes (which the usual hack — text-indent -9999px does) * can probably just apply visibility:hidden to eveything below the cell itself bzr revid: xmo@openerp.com-20121018063703-scz1yl87b7nhgx94 --- addons/web/static/src/css/base.css | 6 ++++++ addons/web/static/src/css/base.sass | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c75042068a9..e4b8885b1a1 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2561,6 +2561,12 @@ .openerp .oe_list.oe_list_editable td.oe_list_record_delete { position: absolute; } +.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) { + color: transparent; +} +.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * { + visibility: hidden; +} .openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button { top: 5px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 20d4be619ed..a128fcec24b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2026,6 +2026,10 @@ $sheet-max-width: 860px td.oe_list_record_delete position: absolute .oe_list.oe_list_editable.oe_editing + .oe_edition .oe_list_field_cell:not(.oe_readonly) + * + visibility: hidden + color: transparent .oe_m2o_drop_down_button top: 5px .oe_m2o_cm_button From 8b4580ea861ba542295ce86aa0f7e5471ed0330a Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 10:50:28 +0200 Subject: [PATCH 14/30] [FIX] Fixed on_loaded in Menu and Search. bzr revid: vta@openerp.com-20121018085028-d0ww48el2jwmtcpg --- addons/web/static/src/js/chrome.js | 8 ++++++-- addons/web/static/src/js/search.js | 15 +++++++++------ addons/web/static/src/js/view_form.js | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index a298ac67159..3cb4437d1c3 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -701,9 +701,12 @@ instance.web.Menu = instance.web.Widget.extend({ return this.do_reload(); }, do_reload: function() { - return this.rpc("/web/menu/load", {}).then(this.on_loaded); + var self = this; + return this.rpc("/web/menu/load", {}).then(function(r) { + self.menu_loaded(r); + }); }, - on_loaded: function(data) { + menu_loaded: function(data) { var self = this; this.data = data; this.renderElement(); @@ -720,6 +723,7 @@ instance.web.Menu = instance.web.Widget.extend({ if (self.current_menu) { self.open_menu(self.current_menu); } + this.trigger('menu_loaded', data); this.has_been_loaded.resolve(); }, limit_entries: function() { diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 400411937c4..26dfd66fb0f 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -324,8 +324,9 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea context: this.dataset.get_context() }); $.when(load_view) - .pipe(this.on_loaded) - .fail(function () { + .pipe(function(r) { + self.search_view_loaded(r) + }).fail(function () { self.ready.reject.apply(null, arguments); }); } @@ -645,7 +646,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea (new instance.web.search.Advanced(this)); }, - on_loaded: function(data) { + search_view_loaded: function(data) { var self = this; this.fields_view = data.fields_view; if (data.fields_view.type !== 'search' || @@ -654,7 +655,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea "Got non-search view after asking for a search view: type %s, arch root %s", data.fields_view.type, data.fields_view.arch.tag)); } - this.make_widgets( data.fields_view['arch'].children, data.fields_view.fields); @@ -671,9 +671,12 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'facet_for_defaults', this.defaults)).then(function () { self.query.reset(_(arguments).compact(), {preventSearch: true}); }); - self.trigger("search_view_load"); + return $.when(drawer_started, defaults_fetched) - .then(function () { self.ready.resolve(); }) + .then(function () { + self.trigger("search_view_loaded", data); + self.ready.resolve(); + }); }, /** * Handle event when the user make a selection in the filters management select box. diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 11250a5c394..9951a79b8c7 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4476,7 +4476,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys); } }); - this.searchview.on("search_view_load",self,function () { + this.searchview.on("search_view_loaded", self, function() { self.view_list = new instance.web.form.SelectCreateListView(self, self.dataset, false, _.extend({'deletable': false, From 1e708371616e324c1ba570f85e1f9cd50b216c09 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 13:49:50 +0200 Subject: [PATCH 15/30] [FIX] Fixed on_loaded in all different views. bzr revid: vta@openerp.com-20121018114950-svqy0gje04vw2ysc --- addons/web/static/src/js/view_form.js | 17 +++++++++-------- addons/web/static/src/js/view_list.js | 7 ++++--- addons/web/static/src/js/views.js | 17 +++++++---------- addons/web_calendar/static/src/js/calendar.js | 6 ++++-- addons/web_diagram/static/src/js/diagram.js | 14 +++++++++----- addons/web_gantt/static/src/js/gantt.js | 4 +++- addons/web_graph/static/src/js/graph.js | 6 ++++-- addons/web_kanban/static/src/js/kanban.js | 6 ++++-- 8 files changed, 44 insertions(+), 33 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 9951a79b8c7..e78eb98cc5b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -127,6 +127,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM self.init_pager(); }); self.on("load_record", self, self.load_record); + this.on('view_loaded', self, self.load_form); instance.web.bus.on('clear_uncommitted_changes', this, function(e) { if (!this.can_be_discarded()) { e.preventDefault(); @@ -143,13 +144,13 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } this._super(); }, - on_loaded: function(data) { + load_form: function(data) { var self = this; if (!data) { throw new Error("No data provided."); } if (this.arch) { - throw "Form view does not support multiple calls to on_loaded"; + throw "Form view does not support multiple calls to load_form"; } this.fields_order = []; this.fields_view = data; @@ -213,7 +214,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM e.stopPropagation(); } }); - this._super.apply(this, arguments); + this.trigger('form_view_loaded', data); return $.when(); }, widgetFocused: function() { @@ -3802,7 +3803,7 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({ instance.web.form.One2ManyFormView = instance.web.FormView.extend({ form_template: 'One2Many.formview', - on_loaded: function(data) { + load_form: function(data) { this._super(data); var self = this; this.$buttons.find('button.oe_form_button_create').click(function() { @@ -4012,7 +4013,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ } this.list_view.m2m_field = this; var loaded = $.Deferred(); - this.list_view.on("view_loaded",self,function() { + this.list_view.on("list_view_loaded", self, function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4132,7 +4133,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( } this.kanban_view.m2m = this; var loaded = $.Deferred(); - this.kanban_view.on("view_loaded",self,function() { + this.kanban_view.on("kanban_view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4356,7 +4357,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.view_form.set_embedded_view(this.options.alternative_form_view); } this.view_form.appendTo(this.$el.find(".oe_popup_form")); - this.view_form.on("view_loaded",self,function() { + this.view_form.on("form_view_loaded", self, function() { var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { multi_select: multi_select, @@ -4493,7 +4494,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }).pipe(function() { self.searchview.do_search(); }); - self.view_list.on("view_loaded",self,function() { + self.view_list.on("list_view_loaded", self, function() { self.$buttonpane.html(QWeb.render("SelectCreatePopup.search.buttons", {widget:self})); var $cbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-close"); $cbutton.click(function() { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 260e62abaa2..99293b2bb0c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -83,6 +83,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi }); this.no_leaf = false; + this.on('view_load', self, self.load_list); }, set_default_options: function (options) { this._super(options); @@ -218,7 +219,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi * @param {Object} data.fields_view.arch current list view descriptor * @param {Boolean} grouped Is the list view grouped */ - on_loaded: function(data, grouped) { + load_list: function(data, grouped) { var self = this; this.fields_view = data; this.name = "" + this.fields_view.arch.attrs.string; @@ -358,7 +359,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.sidebar.add_toolbar(this.fields_view.toolbar); this.sidebar.$el.hide(); } - this._super.apply(this, arguments); + this.trigger('list_view_loaded', data, grouped); }, /** * Configures the ListView pager based on the provided dataset's information @@ -469,7 +470,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi reload_view: function (grouped, context, initial) { var self = this; var callback = function (field_view_get) { - self.on_loaded(field_view_get, grouped); + self.load_list(field_view_get, grouped); }; if (this.embedded_view) { return $.Deferred().then(callback).resolve(this.embedded_view); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index d526e75ac1d..6e37e37011c 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1135,11 +1135,13 @@ instance.web.View = instance.web.Widget.extend({ return this.load_view(); }, load_view: function() { + var self = this; if (this.embedded_view) { var def = $.Deferred(); - var self = this; $.async_when().then(function() {def.resolve(self.embedded_view);}); - return def.pipe(this.on_loaded); + return def.pipe(function(r) { + self.trigger('view_loaded', r); + }); } else { var context = new instance.web.CompoundContext(this.dataset.get_context()); if (! this.view_type) @@ -1150,16 +1152,11 @@ instance.web.View = instance.web.Widget.extend({ "view_type": this.view_type, toolbar: !!this.options.$sidebar, context: context - }).pipe(this.on_loaded); + }).pipe(function(r) { + self.trigger('view_loaded', r); + }); } }, - /** - * Called after a successful call to fields_view_get. - * Must return a promise. - */ - on_loaded: function(fields_view_get) { - this.trigger("view_loaded"); - }, set_default_options: function(options) { this.options = options || {}; _.defaults(this.options, { diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 03d22e0dcbd..9bc76e814e6 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -12,6 +12,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ display_name: _lt('Calendar'), // Dhtmlx scheduler ? init: function(parent, dataset, view_id, options) { + var self = this; this._super(parent); this.ready = $.Deferred(); this.set_default_options(options); @@ -38,6 +39,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ this.range_stop = null; this.update_range_dates(Date.today()); this.selected_filters = []; + this.on('view_loaded', self, self.load_calendar); }, start: function() { this._super(); @@ -47,7 +49,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ scheduler.clearAll(); this._super(); }, - on_loaded: function(data) { + load_calendar: function(data) { this.fields_view = data; this.$el.addClass(this.fields_view.arch.attrs['class']); this.calendar_fields = {}; @@ -106,7 +108,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ this.sidebar = new instance.web_calendar.Sidebar(this); this.has_been_loaded.pipe(this.sidebar.appendTo(this.$el.find('.oe_calendar_sidebar_container'))); } - + this.trigger('calendar_view_loaded', data); return this.has_been_loaded.resolve(); }, init_scheduler: function() { diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index 4bae1aed3db..8bc817690c5 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -11,6 +11,7 @@ instance.web.DiagramView = instance.web.View.extend({ display_name: _lt('Diagram'), searchable: false, init: function(parent, dataset, view_id, options) { + var self = this; this._super(parent); this.set_default_options(options); this.view_manager = parent; @@ -20,17 +21,20 @@ instance.web.DiagramView = instance.web.View.extend({ this.domain = this.dataset._domain || []; this.context = {}; this.ids = this.dataset.ids; + this.on('view_loaded', self, self.load_diagram); }, start: function() { - return this.rpc("/web_diagram/diagram/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded); + var self = this; + return this.rpc("/web_diagram/diagram/load", {"model": this.model, "view_id": this.view_id}).then(function(r) { + self.load_diagram(r); + }); }, toTitleCase: function(str) { return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); }, - on_loaded: function(result) { - + load_diagram: function(result) { var self = this; if(this.ids && this.ids.length) { this.id = this.ids[self.dataset.index || 0]; @@ -47,7 +51,7 @@ instance.web.DiagramView = instance.web.View.extend({ return label.tag == "label"; }); - this.$el.html(QWeb.render("DiagramView", {'widget': this})); + this.$el.html(QWeb.render("DiagramView", {'widget': self})); this.$el.addClass(this.fields_view.arch.attrs['class']); _.each(self.labels,function(label){ @@ -68,7 +72,7 @@ instance.web.DiagramView = instance.web.View.extend({ if(this.id) { self.get_diagram_info(); } - + this.trigger('diagram_view_loaded', result); }, get_diagram_info: function() { diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js index 01de4f69b61..040f53568ae 100644 --- a/addons/web_gantt/static/src/js/gantt.js +++ b/addons/web_gantt/static/src/js/gantt.js @@ -12,11 +12,13 @@ instance.web_gantt.GanttView = instance.web.View.extend({ template: "GanttView", view_type: "gantt", init: function() { + var self = this; this._super.apply(this, arguments); this.has_been_loaded = $.Deferred(); this.chart_id = _.uniqueId(); + this.on('view_loaded', self, self.load_gantt); }, - on_loaded: function(fields_view_get, fields_get) { + load_gantt: function(fields_view_get, fields_get) { var self = this; this.fields_view = fields_view_get; this.$el.addClass(this.fields_view.arch.attrs['class']); diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index b82b1521e87..788ec3bcb3f 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -23,6 +23,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ view_type: "graph", init: function(parent, dataset, view_id, options) { + var self = this; this._super(parent); this.set_default_options(options); this.dataset = dataset; @@ -41,6 +42,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.group_by = []; this.graph = null; + this.on('view_loaded', self, self.load_graph); }, destroy: function () { if (this.graph) { @@ -49,7 +51,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ this._super(); }, - on_loaded: function(fields_view_get) { + load_graph: function(fields_view_get) { // TODO: move to load_view and document var self = this; this.fields_view = fields_view_get; @@ -98,7 +100,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ self.forcehtml = false; }); }); - return this._super(); + this.trigger('graph_view_loaded', fields_view_get); }, get_format: function (options) { diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index a38b083fe6c..fc29b29f7ae 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -14,6 +14,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ number_of_color_schemes: 10, init: function (parent, dataset, view_id, options) { this._super(parent, dataset, view_id, options); + var self = this; _.defaults(this.options, { "quick_creatable": true, "creatable": true, @@ -41,6 +42,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.currently_dragging = {}; this.limit = options.limit || 40; this.add_group_mutex = new $.Mutex(); + this.on('view_loaded', self, self.load_kanban); }, start: function() { var self = this; @@ -55,7 +57,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this._super.apply(this, arguments); $('html').off('click.kanban'); }, - on_loaded: function(data) { + load_kanban: function(data) { this.fields_view = data; this.$el.addClass(this.fields_view.arch.attrs['class']); this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); @@ -71,7 +73,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.fields_keys = _.keys(this.fields_view.fields); this.add_qweb_template(); this.has_been_loaded.resolve(); - this._super.apply(this, arguments); + this.trigger('kanban_view_loaded', data); return $.when(); }, _is_quick_create_enabled: function() { From ae8efbed067f49132d2cd720c650816fabfd5d8d Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 13:54:51 +0200 Subject: [PATCH 16/30] [FIX] Fixed on_loaded in editable list. bzr revid: vta@openerp.com-20121018115451-vx4i66o75kld3io9 --- addons/web/static/src/js/view_list_editable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index cd6b018ea0d..4803a856f31 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -100,7 +100,7 @@ openerp.web.list_editable = function (instance) { this._super(); } }, - on_loaded: function (data, grouped) { + load_list: function (data, grouped) { var self = this; // tree/@editable takes priority on everything else if present. var result = this._super(data, grouped); From 1ccd8db9878b6280619188442478341ba4ef4146 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 14:19:47 +0200 Subject: [PATCH 17/30] [FIX] Fixed on_loaded in ViewEditor. bzr revid: vta@openerp.com-20121018121947-xx2334wkt2tr6qcq --- addons/web_view_editor/static/src/js/view_editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_view_editor/static/src/js/view_editor.js b/addons/web_view_editor/static/src/js/view_editor.js index 2732954097d..0750a5fe0b8 100644 --- a/addons/web_view_editor/static/src/js/view_editor.js +++ b/addons/web_view_editor/static/src/js/view_editor.js @@ -74,7 +74,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ $.when(this.action_manager.do_action(action)).then(function() { var viewmanager = self.action_manager.inner_widget; var controller = viewmanager.views[viewmanager.active_view].controller; - controller.on_loaded.add_last(function(){ + controller.on('view_loaded', function(){ $(controller.groups).bind({ 'selected': function(e, ids, records) { self.main_view_id = ids[0]; From 8b2a07eb558af71a5132b748b34e4938fad227c3 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 18 Oct 2012 14:34:03 +0200 Subject: [PATCH 18/30] [REM] dead code bzr revid: xmo@openerp.com-20121018123403-k97t9x0hiie56f2n --- addons/web/static/src/js/search.js | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..8a6019be9d5 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -675,45 +675,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea return $.when(drawer_started, defaults_fetched) .then(function () { self.ready.resolve(); }) }, - /** - * Handle event when the user make a selection in the filters management select box. - */ - on_filters_management: function(e) { - var self = this; - var select = this.$el.find(".oe_search-view-filters-management"); - var val = select.val(); - switch(val) { - case 'advanced_filter': - this.extended_search.on_activate(); - break; - case '': - this.do_clear(); - } - if (val.slice(0, 4) == "get:") { - val = val.slice(4); - val = parseInt(val, 10); - var filter = this.managed_filters[val]; - this.do_clear(false).then(_.bind(function() { - select.val('get:' + val); - - var groupbys = []; - var group_by = filter.context.group_by; - if (group_by) { - groupbys = _.map( - group_by instanceof Array ? group_by : group_by.split(','), - function (el) { return { group_by: el }; }); - } - this.filter_data = { - domains: [filter.domain], - contexts: [filter.context], - groupbys: groupbys - }; - this.do_search(); - }, this)); - } else { - select.val(''); - } - }, /** * Extract search data from the view's facets. * @@ -771,8 +732,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * * If at least one field failed its validation, triggers * :js:func:`instance.web.SearchView.on_invalid` instead. - * - * @param e jQuery event object coming from the "Search" button */ do_search: function (_query, options) { if (options && options.preventSearch) { From 1199780ed47bbbca96d793bec3055a958eb47e0f Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 18 Oct 2012 14:38:27 +0200 Subject: [PATCH 19/30] [FIX] problem in mail_followers.js bzr revid: nicolas.vanhoren@openerp.com-20121018123827-lu6ku0zb9pfddsjc --- addons/mail/static/src/js/mail_followers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index a422c6b4762..3fa33db2ba8 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -139,6 +139,7 @@ openerp_mail_followers = function(session, mail) { /** Display the followers */ display_followers: function (records) { var self = this; + records = records || []; this.message_is_follower = this.set_is_follower(records); // clean and display title var node_user_list = this.$('ul.oe_mail_followers_display').empty(); From f910bc67804e185e486a8355b8ba329942a5c0eb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 18 Oct 2012 14:40:05 +0200 Subject: [PATCH 20/30] [FIX] don't trigger search twice when a facet is removed from the query due to its values becoming empty The facet removal from its last value being removed (`this.remove(facet)` in the 'change' handler of the SearchQuery) broadcasted its `remove` event, triggering the `do_search` (and repaint) hook of the SearchView a second time right after the `change`-triggered search. Not only is this unnecessary and duplicated work (the `remove` is a sync operation, so searchview-attached events haven't yet executed by the time `remove` is called), the listview really doesn't like getting a ``search`` signal while it's already executing a search. So fix that. bzr revid: xmo@openerp.com-20121018124005-6vfi7tqasz32ai8v --- addons/web/static/src/js/search.js | 2 +- addons/web/static/test/search.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 8a6019be9d5..80d5e57bd8f 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -61,7 +61,7 @@ my.SearchQuery = B.Collection.extend({ this.on('change', function (facet) { if(!facet.values.isEmpty()) { return; } - this.remove(facet); + this.remove(facet, {silent: true}); }, this); }, add: function (values, options) { diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js index 6dc37f31d08..59353f9d22d 100644 --- a/addons/web/static/test/search.js +++ b/addons/web/static/test/search.js @@ -1044,8 +1044,12 @@ $(document).ready(function () { "second value should be clicked filter"); }); }); - asyncTest('click removing from query', 2, function () { + asyncTest('click removing from query', 4, function () { + var calls = 0; var view = makeSearchView({}, {foo2: true}); + view.on_search.add(function () { + ++calls; + }); var $fix = $('#qunit-fixture'); view.appendTo($fix) .always(start) @@ -1054,8 +1058,10 @@ $(document).ready(function () { var $fs = $fix.find('.oe_searchview_filters ul'); // sanity check equal(view.query.length, 1, "query should have default facet"); + strictEqual(calls, 0); $fs.children(':eq(1)').trigger('click'); equal(view.query.length, 0, "click should have removed facet"); + strictEqual(calls, 1, "one search should have been triggered"); }); }); From 295e7eef2527c8b5efee8acfbf5cd868ec5293a0 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 14:45:48 +0200 Subject: [PATCH 21/30] [FIX] Fixed name in event. bzr revid: vta@openerp.com-20121018124548-qfan5n9tl31cn3ng --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index fa0ad302fdb..b70e64ddfce 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1242,7 +1242,7 @@ openerp.mail = function(session) { var self = this; this.searchview = new session.web.SearchView(this, this.ds_msg, false, defaults || {}, hidden || false); return this.searchview.appendTo(this.$('.oe_view_manager_view_search')).then(function () { - self.searchview.on('data_search', self, self.do_searchview_search); + self.searchview.on('search_data', self, self.do_searchview_search); }); }, From 59aaa765a669e5f15d083cd9c1c8579cecc57389 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 18 Oct 2012 14:46:07 +0200 Subject: [PATCH 22/30] [FIX] Fixed event name. bzr revid: vta@openerp.com-20121018124607-rifo06nfx7jo134e --- addons/web/static/src/js/search.js | 5 +++-- addons/web/static/src/js/view_form.js | 2 +- addons/web/static/src/js/views.js | 2 +- addons/web/static/test/search.js | 6 +++--- addons/web_hello/static/openerp/base_hello.js | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index d1d96f750f2..c16b65c9831 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -766,7 +766,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea groupbys: groupbys, errors: errors }; - }, /** + }, + /** * Performs the search view collection of widget data. * * If the collection went well (all fields are valid), then triggers @@ -786,7 +787,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.on_invalid(search.errors); return; } - return this.trigger('data_search', search.domains, search.contexts, search.groupbys); + return this.trigger('search_data', search.domains, search.contexts, search.groupbys); }, /** * Triggered after the SearchView has collected all relevant domains and diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1a626912265..9c97f95f4c9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4468,7 +4468,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend } this.searchview = new instance.web.SearchView(this, this.dataset, false, search_defaults); - this.searchview.on('data_search', self, function(domains, contexts, groupbys) { + this.searchview.on('search_data', self, function(domains, contexts, groupbys) { if (self.initial_ids) { self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]), contexts, groupbys); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index d5123f07a9d..705bc1b214e 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -648,7 +648,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ } this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); - this.searchview.on('data_search', self, this.do_searchview_search); + this.searchview.on('search_data', self, this.do_searchview_search); return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search")); }, do_searchview_search: function(domains, contexts, groupbys) { diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js index 7c6556da363..8034ece7e87 100644 --- a/addons/web/static/test/search.js +++ b/addons/web/static/test/search.js @@ -652,7 +652,7 @@ $(document).ready(function () { } }); var ds, cs, gs; - view.on('data_search', this, function (d, c, g) { + view.on('search_data', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -690,7 +690,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds, cs, gs; - view.on('data_search', this, function (d, c, g) { + view.on('search_data', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -718,7 +718,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds; - view.on('data_search', this, function (d) { ds = d; }); + view.on('search_data', this, function (d) { ds = d; }); view.appendTo($fix) .always(start) .fail(function (error) { ok(false, error.message); }) diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index 7bfbf7b78e8..0a22079aa53 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -7,7 +7,7 @@ openerp.web_hello = function(instance) { instance.web.SearchView = instance.web.SearchView.extend({ init:function() { this._super.apply(this,arguments); - this.on('data_search', this, function(){console.log('hello');}); + this.on('search_data', this, function(){console.log('hello');}); } }); From 361c0acd2a44c85ab0bc938d197647df81998ec9 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 18 Oct 2012 14:47:50 +0200 Subject: [PATCH 23/30] [FIX] expression: negative operators (e.g. NOT IN) where not working on o2m fields - tests added bzr revid: odo@openerp.com-20121018124750-bkea51a7zkvwwygi --- openerp/addons/base/test/test_osv_expression.yml | 16 +++++++++++++++- openerp/osv/expression.py | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index 3843d374e64..e2a104bfff2 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -396,7 +396,7 @@ assert res_8 == [1] assert res_9 == [] - # get the companies referenced by some currency (this is normally the main company) + # get the companies referenced by some currency (this is normally the main company) using a weird negative domain res_10 = self.search(cr, uid, [('currency_ids', 'not like', 'probably_unexisting_name')]) res_11 = self.search(cr, uid, [('currency_ids', 'not in', [max_currency_id + 1])]) res_12 = self.search(cr, uid, [('currency_ids', '!=', False)]) @@ -408,6 +408,20 @@ assert res_10 == res_11 assert res_10 == res_12 assert res_10 == res_13 + + # try testing real subsets with IN/NOT IN + res_partner = self.pool.get('res.partner') + res_users = self.pool.get('res.users') + p1, _ = res_partner.name_create(cr, uid, "Dédé Boitaclou") + p2, _ = res_partner.name_create(cr, uid, "Raoulette Pizza O'poil") + u1a = res_users.create(cr, uid, {'login': 'dbo', 'partner_id': p1}) + u1b = res_users.create(cr, uid, {'login': 'dbo2', 'partner_id': p1}) + u2 = res_users.create(cr, uid, {'login': 'rpo', 'partner_id': p2}) + assert [p1] == res_partner.search(cr, uid, [('user_ids', 'in', u1a)]), "o2m IN accept single int on right side" + assert [p1,p2] == res_partner.search(cr, uid, [('user_ids', 'in', [u1a,u2])]), "o2m IN matches any on the right side" + all_partners = res_partner.search(cr, uid, []) + assert (set(all_partners) - set([p1])) == set(res_partner.search(cr, uid, [('user_ids', 'not in', u1a)])), "o2m NOT IN matches none on the right side" + assert (set(all_partners) - set([p1,p2])) == set(res_partner.search(cr, uid, [('user_ids', 'not in', [u1b, u2])])), "o2m NOT IN matches none on the right side" # child_of x returns x and its children (direct or not). company = self.browse(cr, uid, ref('ymltest_company3')) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 5f2c0b915c1..2b2d33a496e 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -540,7 +540,8 @@ class expression(object): ids2 = select_from_where(cr, field._fields_id, field_obj._table, 'id', ids2, operator) if ids2: call_null = False - self.__exp[i] = ('id', 'in', ids2) + o2m_op = 'not in' if operator in NEGATIVE_TERM_OPERATORS else 'in' + self.__exp[i] = ('id', o2m_op, ids2) if call_null: o2m_op = 'in' if operator in NEGATIVE_TERM_OPERATORS else 'not in' From 00dc401ef1c565dc80a7ee75c4f383cac2d14d9a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 18 Oct 2012 14:57:38 +0200 Subject: [PATCH 24/30] [FIX] l10n_us typo: agricultar->agriculture (also fixed in XML ids, should not break anything on existing DBs) bzr revid: odo@openerp.com-20121018125738-wf3utqfhzgexs191 --- addons/l10n_us/account.account.template.csv | 46 +++++++++---------- addons/l10n_us/account_chart_template.xml | 4 +- .../l10n_us/account_chart_template_after.xml | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/addons/l10n_us/account.account.template.csv b/addons/l10n_us/account.account.template.csv index 46430ac37f8..c7431ce89a7 100644 --- a/addons/l10n_us/account.account.template.csv +++ b/addons/l10n_us/account.account.template.csv @@ -69,29 +69,29 @@ "51800_advertising","51800","Merchant Account Fees","other","l10n_us.user_type_cogs","cost_of_goods_sold","FALSE","l10n_us.account_chart_template_advertising" "53500_advertising","53500","Subcontracted Services","other","l10n_us.user_type_cogs","cost_of_goods_sold","FALSE","l10n_us.account_chart_template_advertising" "64200_advertising","64200","Marketing Expense","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_advertising" -"41200_agriculture","41200","Agricultural Program Payments","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"42500_agriculture","42500","Commodity Credit Loans","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"42800_agriculture","42800","Cooperative Distributions","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"42900_agriculture","42900","Crop Insurance Proceeds","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"43000_agriculture","43000","Crop Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"43100_agriculture","43100","Custom Hire Income","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"43600_agriculture","43600","Farmers Market Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"44100_agriculture","44100","Fuel Tax Credits and Other Inc.","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"45500_agriculture","45500","Livestock Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"47400_agriculture","47400","Rental Income","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agricultar" -"61100_agriculture","61100","Car and Truck Expenses","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"61500_agriculture","61500","Chemicals Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"61900_agriculture","61900","Conservation Expenses","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"62300_agriculture","62300","Custom Hire and Contract Labor","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"62900_agriculture","62900","Feed Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"63000_agriculture","63000","Fertilizers and Lime","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"63100_agriculture","63100","Freight and Trucking","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"63200_agriculture","63200","Gasoline, Fuel and Oil","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"67500_agriculture","67500","Seeds and Plants Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"67800_agriculture","67800","Small Tools and Equipment","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"67900_agriculture","67900","Storage and Warehousing","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"68500_agriculture","68500","Uniforms","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" -"68800_agriculture","68800","Veterinary, Breeding, Medicine","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agricultar" +"41200_agriculture","41200","Agricultural Program Payments","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"42500_agriculture","42500","Commodity Credit Loans","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"42800_agriculture","42800","Cooperative Distributions","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"42900_agriculture","42900","Crop Insurance Proceeds","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"43000_agriculture","43000","Crop Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"43100_agriculture","43100","Custom Hire Income","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"43600_agriculture","43600","Farmers Market Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"44100_agriculture","44100","Fuel Tax Credits and Other Inc.","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"45500_agriculture","45500","Livestock Sales","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"47400_agriculture","47400","Rental Income","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_agriculture" +"61100_agriculture","61100","Car and Truck Expenses","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"61500_agriculture","61500","Chemicals Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"61900_agriculture","61900","Conservation Expenses","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"62300_agriculture","62300","Custom Hire and Contract Labor","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"62900_agriculture","62900","Feed Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"63000_agriculture","63000","Fertilizers and Lime","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"63100_agriculture","63100","Freight and Trucking","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"63200_agriculture","63200","Gasoline, Fuel and Oil","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"67500_agriculture","67500","Seeds and Plants Purchased","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"67800_agriculture","67800","Small Tools and Equipment","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"67900_agriculture","67900","Storage and Warehousing","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"68500_agriculture","68500","Uniforms","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" +"68800_agriculture","68800","Veterinary, Breeding, Medicine","other","l10n_us.user_type_expense","expense","FALSE","l10n_us.account_chart_template_agriculture" "24600_construction_trades","24600","Customer Deposits Received","other","l10n_us.user_type_other_current_liability","other_current_liability","FALSE","l10n_us.account_chart_template_construction" "45100_construction_trades","45100","Job Income","other","l10n_us.user_type_income","income","FALSE","l10n_us.account_chart_template_construction" "50800_construction_trades","50800","Commissions Paid","other","l10n_us.user_type_cogs","cost_of_goods_sold","FALSE","l10n_us.account_chart_template_construction" diff --git a/addons/l10n_us/account_chart_template.xml b/addons/l10n_us/account_chart_template.xml index e0b8ed374b3..0863680981f 100644 --- a/addons/l10n_us/account_chart_template.xml +++ b/addons/l10n_us/account_chart_template.xml @@ -19,8 +19,8 @@ - - Agricultar + + Agriculture diff --git a/addons/l10n_us/account_chart_template_after.xml b/addons/l10n_us/account_chart_template_after.xml index 3c570126fcd..5ca3a169aba 100644 --- a/addons/l10n_us/account_chart_template_after.xml +++ b/addons/l10n_us/account_chart_template_after.xml @@ -11,7 +11,7 @@ - + From 6782c33a32fd8ccdfc6b00387beba532e64bf5cf Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 18 Oct 2012 15:41:23 +0200 Subject: [PATCH 25/30] [FIX] only reload m2m listview once after adding n records to it (via dialog) The listview does not support concurrent reload requests, either wait for the previous reload to finish before sending the new one, or just send a single reload. For m2m, can wait and do a single reload so do that. bzr revid: xmo@openerp.com-20121018134123-ox2ccq0wm3r5jwas --- addons/web/static/src/js/view_form.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 6f525f7a8b5..b2caf70dbbe 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4048,13 +4048,17 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in ); var self = this; pop.on("elements_selected", self, function(element_ids) { - _.each(element_ids, function(one_id) { - if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { - self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); + var reload = false; + _(element_ids).each(function (id) { + if(! _.detect(self.dataset.ids, function(x) {return x == id;})) { + self.dataset.set_ids(self.dataset.ids.concat([id])); self.m2m_field.dataset_changed(); - self.reload_content(); + reload = true; } }); + if (reload) { + self.reload_content(); + } }); }, do_activate_record: function(index, id) { From 77415e7f7780ebc777e2a7f8e89e7adf781e6133 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 18 Oct 2012 16:16:07 +0200 Subject: [PATCH 26/30] [IMP] Finally allow to call set() with 2 arguments. bzr revid: nicolas.vanhoren@openerp.com-20121018141607-jpow2bu1dlvdriyd --- addons/web/static/src/js/corelib.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index 7f4f8c0d6ca..41960dd278d 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -393,8 +393,17 @@ instance.web.PropertiesMixin = _.extend({}, instance.web.EventDispatcherMixin, { instance.web.EventDispatcherMixin.init.call(this); this.__getterSetterInternalMap = {}; }, - set: function(map, options) { - options = options || {}; + set: function(arg1, arg2, arg3) { + var map; + var options; + if (typeof arg1 === "string") { + map = {}; + map[arg1] = arg2; + options = arg3 || {}; + } else { + map = arg1; + options = arg2 || {}; + } var self = this; var changed = false; _.each(map, function(val, key) { From adb172b7cb19a4b0c0cb5b8c4840c90cff431b4e Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 18 Oct 2012 16:37:30 +0200 Subject: [PATCH 27/30] [IMP] Binary fields, use html5 api if available bzr revid: fme@openerp.com-20121018143730-2qoalz6uye5ggbn5 --- addons/web/static/src/js/view_form.js | 40 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 9c97f95f4c9..60bdec3b9f9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4643,14 +4643,19 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. var self = this; this._super(field_manager, node); this.binary_value = false; - this.fileupload_id = _.uniqueId('oe_fileupload'); - $(window).on(this.fileupload_id, function() { - var args = [].slice.call(arguments).slice(1); - self.on_file_uploaded.apply(self, args); - }); + this.useFileAPI = !!window.FileReader; + if (!this.useFileAPI) { + this.fileupload_id = _.uniqueId('oe_fileupload'); + $(window).on(this.fileupload_id, function() { + var args = [].slice.call(arguments).slice(1); + self.on_file_uploaded.apply(self, args); + }); + } }, stop: function() { - $(window).off(this.fileupload_id); + if (!this.useFileAPI) { + $(window).off(this.fileupload_id); + } this._super.apply(this, arguments); }, initialize_content: function() { @@ -4668,13 +4673,22 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. return size.toFixed(2) + ' ' + units[i]; }, on_file_change: function(e) { - // TODO: on modern browsers, we could directly read the file locally on client ready to be used on image cropper - // http://www.html5rocks.com/tutorials/file/dndfiles/ - // http://deepliquid.com/projects/Jcrop/demos.php?demo=handler - - if ($(e.target).val() !== '') { - this.$el.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); - this.$el.find('form.oe_form_binary_form').submit(); + var self = this; + var file_node = e.target; + if ((this.useFileAPI && file_node.files.length) || (!this.useFileAPI && $(file_node).val() !== '')) { + if (this.useFileAPI) { + var file = file_node.files[0]; + var filereader = new FileReader(); + filereader.readAsDataURL(file); + filereader.onloadend = function(upload) { + var data = upload.target.result; + data = data.split(',')[1]; + self.on_file_uploaded(file.size, file.name, file.type, data); + }; + } else { + this.$el.find('form.oe_form_binary_form input[name=session_id]').val(this.session.session_id); + this.$el.find('form.oe_form_binary_form').submit(); + } this.$el.find('.oe_form_binary_progress').show(); this.$el.find('.oe_form_binary').hide(); } From 4223b1e786fbe6724079953825e67cf205184400 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 18 Oct 2012 16:57:12 +0200 Subject: [PATCH 28/30] [IMP] add overridable dimension-setting method on form fields bzr revid: xmo@openerp.com-20121018145712-am4y6bdnz2x14i2c --- addons/web/static/src/js/view_form.js | 21 +++++++++++++++++++ .../web/static/src/js/view_list_editable.js | 4 +--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b2caf70dbbe..1a142b4c43b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2143,6 +2143,20 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w self.do_action(r); }); }, + + set_dimensions: function (height, width) { + // remove width css property + this.$el.css('width', ''); + // extract style (without width) + var old_style = this.$el.attr('style'); + // jQuery doesn't understand/use !important + var style = 'width:' + width + 'px !important;'; + if (old_style) { + style += old_style + } + this.$el.attr('style', style); + this.$el.css('minHeight', height); + } }); /** @@ -2521,6 +2535,13 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we focus: function($el) { this.$textarea.focus(); }, + set_dimensions: function (height, width) { + this._super(); + this.$textarea.css({ + width: width, + minHeight: height + }); + }, }); /** diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 3a3b06cbedf..9683dbd804b 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -251,12 +251,10 @@ openerp.web.list_editable = function (instance) { var $cell = $(cell); var position = $cell.position(); - // jquery does not understand !important - field.$el.attr('style', 'width: '+$cell.outerWidth()+'px !important'); + field.set_dimensions($cell.outerHeight(), $cell.outerWidth()); field.$el.css({ top: position.top, left: position.left, - minHeight: $cell.outerHeight() }); }, /** From 6e0439994576e317a93dbd5bd9b7ef2fa9f40a68 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 18 Oct 2012 17:47:55 +0200 Subject: [PATCH 29/30] [FIX] m2o#focus() does nothing when readonly bzr revid: fme@openerp.com-20121018154755-a9hurjb0664l03x2 --- addons/web/static/src/js/view_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c2262c0d69d..d096e15b51d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3172,7 +3172,9 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc return ! this.get("value"); }, focus: function () { - this.$input.focus(); + if (!this.get('effective_readonly')) { + this.$input.focus(); + } }, _quick_create: function() { this.no_ed = true;