From cdff5c13665062b6a8aa0d3476a022e6ef7e0810 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Thu, 5 Dec 2013 13:11:18 +0100 Subject: [PATCH 01/10] [IMP] Performance: by-pass call to _apply_ir_rules for user admin bzr revid: cto@openerp.com-20131205121118-0f9087y2huo7y44l --- openerp/osv/orm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 9e6ee64d87f..306a2d50951 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4711,6 +4711,9 @@ class BaseModel(object): :param query: the current query object """ + if uid == SUPERUSER_ID: + return + def apply_rule(added_clause, added_params, added_tables, parent_model=None, child_object=None): """ :param string parent_model: string of the parent model :param model child_object: model object, base of the rule application From 025657653c9c4a60f9545228af7ea6ff79273831 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Fri, 6 Dec 2013 11:20:51 +0100 Subject: [PATCH 02/10] [FIX] field email_from in crm.lead form view should have a widget email bzr revid: cto@openerp.com-20131206102051-cls1gh78ze2olst9 --- addons/crm/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 642e9ef6585..7c087ebd5a8 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -412,7 +412,7 @@ on_change="onchange_partner_id(partner_id, email_from)" string="Customer" context="{'default_name': partner_name, 'default_email': email_from, 'default_phone': phone}"/> - + From 2e197cbb98a14bb96302136cee9ecab75a68159f Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Mon, 9 Dec 2013 15:11:11 +0100 Subject: [PATCH 03/10] [IMP] Batch for the computation of function's stored values is now customizable bzr revid: cto@openerp.com-20131209141111-tbg9x1h8l6neu0ml --- openerp/osv/orm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 9e6ee64d87f..5c9c7802863 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -79,6 +79,9 @@ from openerp.tools import SKIPPED_ELEMENT_TYPES regex_order = re.compile('^(([a-z0-9_]+|"[a-z0-9_]+")( *desc| *asc)?( *, *|))+$', re.I) regex_object_name = re.compile(r'^[a-z0-9_.]+$') +# TODO for trunk, raise the value to 1000 +AUTOINIT_RECALCULATE_STORED_FIELDS = 40 + def transfer_field_to_modifiers(field, modifiers): default_values = {} state_exceptions = {} @@ -2794,8 +2797,8 @@ class BaseModel(object): cr.execute('select id from '+self._table) ids_lst = map(lambda x: x[0], cr.fetchall()) while ids_lst: - iids = ids_lst[:40] - ids_lst = ids_lst[40:] + iids = ids_lst[:AUTOINIT_RECALCULATE_STORED_FIELDS] + ids_lst = ids_lst[AUTOINIT_RECALCULATE_STORED_FIELDS:] res = f.get(cr, self, iids, k, SUPERUSER_ID, {}) for key, val in res.items(): if f._multi: From 68aac8e85515f69b98492fd4c20a62004086595a Mon Sep 17 00:00:00 2001 From: Michel Meyer Date: Mon, 9 Dec 2013 16:35:19 +0100 Subject: [PATCH 04/10] [FIX] events handling ordering courtesy of Michel Meyer lead to errors during the validation of rows in list o2ms. See https://bugs.launchpad.net/openerp-web/+bug/1182101/comments/20 for an extensive description of the events and issue. bzr revid: xmo@openerp.com-20131209153519-n05bdx15t75dh7gf --- addons/web/static/src/js/view_form.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 080cd6f70aa..3893626520f 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3822,7 +3822,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ GroupsType: instance.web.form.One2ManyGroups, ListType: instance.web.form.One2ManyList })); - this.on('edit:before', this, this.proxy('_before_edit')); this.on('edit:after', this, this.proxy('_after_edit')); this.on('save:before cancel:before', this, this.proxy('_before_unedit')); @@ -3943,11 +3942,10 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ }); }, - _before_edit: function () { + _after_edit: function () { this.__ignore_blur = false; this.editor.form.on('blurred', this, this._on_form_blur); - }, - _after_edit: function () { + // The form's blur thing may be jiggered during the edition setup, // potentially leading to the o2m instasaving the row. Cancel any // blurring triggered the edition startup here From 3b328aaab4d6b1f1ad6416e299b760b1658730fd Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Mon, 9 Dec 2013 16:48:57 +0100 Subject: [PATCH 05/10] [FIX] Trigger stored field recalculation for inherited records The create() method implicitly creates record on objects of the _inherits. Therefore, in order to make the trigger on linked field works, we should include all the _inherits values (field that makes the link to the rel record) because they are created implicitly. bzr revid: cto@openerp.com-20131209154857-788f94w0kh6ef5pp --- openerp/osv/orm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 7ecf4afc6cd..5f7403ee223 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4487,7 +4487,9 @@ class BaseModel(object): self._validate(cr, user, [id_new], context) if not context.get('no_store_function', False): - result += self._store_get_values(cr, user, [id_new], vals.keys(), context) + result += self._store_get_values(cr, user, [id_new], + list(set(vals.keys() + self._inherits.values())), + context) result.sort() done = [] for order, object, ids, fields2 in result: From 029c866b8c68a7eb15a04ee1e42fac7c69889aa4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 10 Dec 2013 10:30:55 +0100 Subject: [PATCH 06/10] [FIX] issue when tabbing too much at end of editable list row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tabbing is intercepted by keydown_TAB, which — if the current cell is the last active field of the row — will then call _next:476. _next then calls save_edition:300 which "takes a lock" (more precisely serializes access to its body) and within its body checks if an edition is active (:303) and returns immediately if not (:304). The problem here is when a second tab event arrives during the potentially extremely long save_edition body (since for toplevel lists it needs to perform a complete RPC call): the overall state of the list has not changed so the second event *also* goes into _next, then into save_edition. There it's serialized with the ongoing call and thus inactive until said ongoing call's termination, and reaches the body after the current edition has been wound down. As a result, the body of _next (:408) gets the resolution of ``$.when()``, which is ``null`` and the first condition blows up. There are 3 possible ways to fix this: * adding a check in keydown_TAB's handler to see whether a _next call is ongoing. This requires adding a state flag to the object and does not protect (or cooperate with) _next calls from outside this specific handler, unless they are modified in turn. * alter save_edition to *fail* in case there's no ongoing edition: this part was originally in ensure_saved which does not care whether a save was necessary or not and does not propagate save information, so ``$.when()`` made sense. In save_edition, there are really 3 different outcomes: the save succeeded, the save failed (or potentially part of save's postprocessing failed, for the current implementation) and the save was unnecessary. But deferred only provide 1 bit of state (success or failure), so the last state has to be merged into either success or failure. Both make sense, to an extent. Changing from one to the other (as necessary here) could break existing code and have more extensive effects than expected. * the simplest and least far-raging change is to just alter the save_edition().then handler to ignore cases where save_edition() results in no saveinfo, this can be assumed to be a bailed-out/unnecessary save call. For simplicity, the 3rd solution was picked here although with more extensive tests &al I'd have preferred trying out 2nd. lp bug: https://launchpad.net/bugs/1253899 fixed bzr revid: xmo@openerp.com-20131210093055-207fevqc1npy7fwr --- addons/web/static/src/js/view_list_editable.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 512fc4ff373..f00296eec40 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -477,6 +477,7 @@ openerp.web.list_editable = function (instance) { next_record = next_record || 'succ'; var self = this; return this.save_edition().then(function (saveInfo) { + if (!saveInfo) { return null; } if (saveInfo.created) { return self.start_edition(); } From f32b87e14d7b1c587389eaabde676060e54b6fb3 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 10 Dec 2013 12:24:44 +0100 Subject: [PATCH 07/10] [FIX] css: avoid tabs in row below to move when selected (opw 601379) bzr revid: mat@openerp.com-20131210112444-pk9yh8bke1z7eerr --- addons/web/static/src/css/base.css | 4 ++++ addons/web/static/src/css/base.sass | 3 +++ 2 files changed, 7 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index edd4d4869a5..fabb8503b34 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -623,6 +623,10 @@ display: block; color: gray; } +.openerp .ui-tabs .oe_notebook.ui-tabs-nav li.ui-tabs-active { + border-bottom: none; + padding-bottom: 1px; +} .openerp .oe_notebook > li.ui-tabs-active > a { color: #4c4c4c; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 4814e64c590..c54cd2920c0 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -561,6 +561,9 @@ $sheet-padding: 16px text-decoration: none background-color: #eee border-color: #eee #eee #ddd + .ui-tabs .oe_notebook.ui-tabs-nav li.ui-tabs-active + border-bottom: none + padding-bottom: 1px .oe_notebook > li.ui-state-active > a, .oe_notebook > li.ui-state-active > a:hover background-color: #ffffff border: 1px solid #ddd From 9322b677aa7848ab6ece42786f46137ff7eea05c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 10 Dec 2013 13:47:55 +0100 Subject: [PATCH 08/10] [FIX] weird behavior when drag&dropping a row during edition in editable listview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When dropping, would simultanously stop the edition and try a write (so 2 writes on the same record) and generally screw up the state of all the things, ending up with an empty row and a weird (and incorrect) warning. This can be fixed by preventing resequencing during the creation or edition of a record (row) inline. For simplicity, implemented by looking up .ui-sortable descendants — there are no utility methods for handling that and, aside from the class, there's no good way to know if sortability was enabled on a list body or not (as far as I can see, jquery-ui's sortable has no API to query that) — and using jquery-ui's sortable API for enabling and disabling sortable on the fly. lp bug: https://launchpad.net/bugs/1257753 fixed bzr revid: xmo@openerp.com-20131210124755-ugr3ehf744qoh1o5 --- addons/web/static/src/js/view_list_editable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index f00296eec40..f2fd8974d81 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -50,8 +50,10 @@ openerp.web.list_editable = function (instance) { }); this.on('edit:after', this, function () { self.$el.add(self.$buttons).addClass('oe_editing'); + self.$('.ui-sortable').sortable('disable'); }); this.on('save:after cancel:after', this, function () { + self.$('.ui-sortable').sortable('enable'); self.$el.add(self.$buttons).removeClass('oe_editing'); }); }, From 762774df3749ae6c1205878f430f0d886c42ea55 Mon Sep 17 00:00:00 2001 From: xmo <> Date: Tue, 10 Dec 2013 16:57:03 +0100 Subject: [PATCH 09/10] [FIX] prevent field going to be misplaced when going from readonly to writable in editable list view bzr revid: mat@openerp.com-20131210155703-2mzqa2mch46nxpcj --- addons/web/static/src/js/view_list_editable.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index f2fd8974d81..bd9cee06797 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -451,6 +451,13 @@ openerp.web.list_editable = function (instance) { field.on("change:effective_readonly", self, set_invisible); field.on("change:invisible", self, set_invisible); set_invisible(); + field.on('change:invisible', self, function () { + if (field.get('invisible')) { return; } + var item = _(self.fields_for_resize).find(function (item) { + return item.field === field; + }); + if (item) { self.resize_field(item.field, item.cell); } + }); }); this.editor.$el.on('keyup keydown', function (e) { From 5cecb92cf82c5191226d3fd0fc2ca757da7f2b67 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 10 Dec 2013 17:05:05 +0100 Subject: [PATCH 10/10] [FIX] stock: incoming shipment supplier quick create was creating a customer instead of a supplier bzr revid: dle@openerp.com-20131210160505-xdeeyooj07im8vz3 --- addons/stock/stock_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index ac769271dbc..72adde4ef20 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1034,7 +1034,7 @@