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 @@ - + 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: 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') diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 6b629a16bc6..bdcf0ab02f5 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1046,8 +1046,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) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index a56ab6be380..f08dc31021a 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -269,6 +269,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); @@ -277,6 +282,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); diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 8b400bec367..3a8484909a8 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -345,11 +345,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; } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b645db41eaa..f5af0963c7f 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2440,6 +2440,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); @@ -2558,8 +2559,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"); } diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index fb7045477b6..ea2c28d9c3f 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -254,7 +254,10 @@ }, 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; });