From a32e989fbadab7691191d8872e69970d4763b8fe Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 17 Jun 2014 12:56:13 +0200 Subject: [PATCH 1/8] [FIX] web: save date(time) field value on key enter in editable list In editable list, on keypress enter, the _next method is called, saving the current line and starting the edition of the next one The _next is triggered before the date(time) field change event, and, therefore, the saved value of the date(time) field is the old one --- addons/web/static/src/js/view_form.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e9f195b892a..fec7ce10607 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2422,6 +2422,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ type_of_date: "datetime", events: { 'change .oe_datepicker_master': 'change_datetime', + 'keypress .oe_datepicker_master': 'change_datetime', }, init: function(parent) { this._super(parent); @@ -2540,8 +2541,8 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ format_client: function(v) { return instance.web.format_value(v, {"widget": this.type_of_date}); }, - change_datetime: function() { - if (this.is_valid_()) { + change_datetime: function(e) { + if ((e.type !== "keypress" || e.which === 13) && this.is_valid_()) { this.set_value_from_ui_(); this.trigger("datetime_changed"); } From 86b80cf95eb658dad45f96bbf5238e7edb777d78 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 18 Jun 2014 11:12:27 +0200 Subject: [PATCH 2/8] [FIX] web: allow using dates and datetimes without leading zeros --- addons/web/static/src/js/formats.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 0c3577b2671..cf53d9fb3f0 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -264,6 +264,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { case 'datetime': var datetime = Date.parseExact( value, (date_pattern + ' ' + time_pattern)); + if (datetime !== null) + return instance.web.datetime_to_str(datetime); + datetime = Date.parseExact(value.replace(/\d+/g, function(m){ + return m.length === 1 ? "0" + m : m ; + }), (date_pattern + ' ' + time_pattern)); if (datetime !== null) return instance.web.datetime_to_str(datetime); datetime = Date.parse(value); @@ -272,6 +277,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value)); case 'date': var date = Date.parseExact(value, date_pattern); + if (date !== null) + return instance.web.date_to_str(date); + date = Date.parseExact(value.replace(/\d+/g, function(m){ + return m.length === 1 ? "0" + m : m ; + }), date_pattern); if (date !== null) return instance.web.date_to_str(date); date = Date.parse(value); From d1e9633c46a755d3c758fb19860509acc355845d Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Wed, 18 Jun 2014 15:49:38 +0530 Subject: [PATCH 3/8] [FIX] l10n_be_invoice_bba: Fixed the length of random generated code to ensure it generates 10 digit code so that it allows validation of invoice. (Maintenance Case: 608485) --- addons/l10n_be_invoice_bba/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_be_invoice_bba/invoice.py b/addons/l10n_be_invoice_bba/invoice.py index 854593a87cc..499e6e6c4ac 100644 --- a/addons/l10n_be_invoice_bba/invoice.py +++ b/addons/l10n_be_invoice_bba/invoice.py @@ -141,7 +141,7 @@ class account_invoice(osv.osv): elif algorithm == 'random': if not self.check_bbacomm(reference): base = random.randint(1, 9999999999) - bbacomm = str(base).rjust(7, '0') + bbacomm = str(base).rjust(10, '0') base = int(bbacomm) mod = base % 97 or 97 mod = str(mod).rjust(2, '0') From f29ff5ef70fdf5035bee05ddb9e2bea33454fa0b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 18 Jun 2014 15:22:44 +0200 Subject: [PATCH 4/8] [FIX] auth_crypt: encrypt all passwords at installation When `base_crypt` was updated for v7, the auto-encryption at installation was dropped, with user passwords only encrypted on-demand whenever the user would connect. It is important to encrypt all passwords immediately to prevent password compromission for user who do not login often or even for deactivated users who are not allowed to login anymore. Fixes https://bugs.launchpad.net/openobject-addons/+bug/1280152 Based on LP merge proposal by Nicolas Bessi (Camptocamp): https://code.launchpad.net/~camptocamp/openobject-addons/improve_auth_crypt_3_please_launchpad_work-nbi/+merge/206476 --- addons/auth_crypt/auth_crypt.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/addons/auth_crypt/auth_crypt.py b/addons/auth_crypt/auth_crypt.py index 4651d27fe7d..c5bd5799017 100644 --- a/addons/auth_crypt/auth_crypt.py +++ b/addons/auth_crypt/auth_crypt.py @@ -117,10 +117,22 @@ def sh256crypt(cls, password, salt, magic=magic_sha256): class res_users(osv.osv): _inherit = "res.users" + def init(self, cr): + """Encrypt all passwords at module installation""" + cr.execute("SELECT id, password FROM res_users WHERE password IS NOT NULL and password != ''") + for user in cr.fetchall(): + self._set_encrypted_password(cr, user[0], user[1]) + + def _set_encrypted_password(self, cr, uid, plain_password): + """Set an encrypted password for a given user""" + salt = gen_salt() + stored_password_crypt = md5crypt(plain_password, salt) + cr.execute("UPDATE res_users SET password = '', password_crypt = %s WHERE id = %s", + (stored_password_crypt, uid)) + def set_pw(self, cr, uid, id, name, value, args, context): if value: - encrypted = md5crypt(value, gen_salt()) - cr.execute("update res_users set password='', password_crypt=%s where id=%s", (encrypted, id)) + self._set_encrypted_password(cr, id, value) del value def get_pw( self, cr, uid, ids, name, args, context ): @@ -144,9 +156,7 @@ class res_users(osv.osv): if cr.rowcount: stored_password, stored_password_crypt = cr.fetchone() if stored_password and not stored_password_crypt: - salt = gen_salt() - stored_password_crypt = md5crypt(stored_password, salt) - cr.execute("UPDATE res_users SET password='', password_crypt=%s WHERE id=%s", (stored_password_crypt, uid)) + self._set_encrypted_password(cr, uid, stored_password) try: return super(res_users, self).check_credentials(cr, uid, password) except openerp.exceptions.AccessDenied: From db40033a39f047e67e53d2db5ae8245bbae37669 Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Fri, 13 Jun 2014 16:08:12 +0530 Subject: [PATCH 5/8] Removed widge=selection from account_id field in line in Purchase Receipt, as it only displays limited records(100) from the limit set in the name_search --- addons/account_voucher/voucher_sales_purchase_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 97f96f75901..2dd53832529 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -248,7 +248,7 @@ - + From 3d43f9d454346d11ce9439ce57ec747dc26a8330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 19 Jun 2014 12:43:25 +0200 Subject: [PATCH 6/8] [FIX] fixes searchbar navigation (web client) the code handling the keydown events was moved, but the variable this was not adjusted accordingly, resulting in a broken navigation. It is now possible to press LEFT and RIGHT again to move the focus between facets. --- addons/web/static/src/js/search.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 1f616202c3f..30b381d8738 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -331,11 +331,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'keydown .oe_searchview_input, .oe_searchview_facet': function (e) { switch(e.which) { case $.ui.keyCode.LEFT: - this.focusPreceding(this); + this.focusPreceding(e.target); e.preventDefault(); break; case $.ui.keyCode.RIGHT: - this.focusFollowing(this); + this.focusFollowing(e.target); e.preventDefault(); break; } From e7285c6e1d7aa6df8efeb46dbe508265f8c3669f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20El=20Khayat?= Date: Thu, 19 Jun 2014 14:51:32 +0200 Subject: [PATCH 7/8] Production : Source location of the BOM Use the source location defined on the current MO's routing not directly on the BOM --- addons/mrp/mrp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 2b5d68177f1..e8e1887caf8 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1037,8 +1037,8 @@ class mrp_production(osv.osv): # Take routing location as a Source Location. source_location_id = production.location_src_id.id - if production.bom_id.routing_id and production.bom_id.routing_id.location_id: - source_location_id = production.bom_id.routing_id.location_id.id + if production.routing_id and production.routing_id.location_id: + source_location_id = production.routing_id.location_id.id for line in production.product_lines: consume_move_id = self._make_production_consume_line(cr, uid, line, produce_move_id, source_location_id=source_location_id, context=context) From 893e4aae9fd6bb1be29b7ee036d608102cef4cb6 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 19 Jun 2014 14:58:44 +0200 Subject: [PATCH 8/8] [FIX] web: focused field in view editable list When adding an item to the editable list, the focused field was no longer the first visible field This is related to revision 4a508885ac043b25465aa5741955082aa66ce949 visible_columns list is not ordered --- addons/web/static/src/js/view_list_editable.js | 5 ++++- 1 file changed, 4 insertions(+), 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 b97aef19815..7d2e44263ce 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -251,7 +251,10 @@ openerp.web.list_editable = function (instance) { }, options).then(function () { $recordRow.addClass('oe_edition'); self.resize_fields(); - var focus_field = options && options.focus_field ? options.focus_field : (self.visible_columns.length ? self.visible_columns[0].name : undefined); + var focus_field = options && options.focus_field ? options.focus_field : undefined; + if (!focus_field){ + focus_field = _.find(self.editor.form.fields_order, function(field){ return fields[field] && fields[field].$el.is(':visible:has(input)'); }); + } if (focus_field) fields[focus_field].$el.find('input').select(); return record.attributes; });