[MERGE] forward port of branch 7.0 up to e5533d0
This commit is contained in:
commit
bf53aeda94
|
@ -248,7 +248,7 @@
|
|||
<page string="Bill Information">
|
||||
<field name="line_dr_ids" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" context="{'journal_id':journal_id,'partner_id':partner_id}">
|
||||
<tree string="Expense Lines" editable="bottom">
|
||||
<field name="account_id" widget="selection" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
|
||||
<field name="account_id" domain="[('user_type.report_type','=','expense'), ('type','!=','view')]"/>
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue