diff --git a/openerp/addons/base/res/res_user.py b/openerp/addons/base/res/res_user.py index 2ef2bb8d4d0..4a136597ffa 100644 --- a/openerp/addons/base/res/res_user.py +++ b/openerp/addons/base/res/res_user.py @@ -206,6 +206,9 @@ class users(osv.osv): raise osv.except_osv(_('Operation Canceled'), _('Please use the change password wizard (in User Preferences or User menu) to change your own password.')) self.write(cr, uid, id, {'password': value}) + def _get_password(self, cr, uid, ids, arg, karg, context=None): + return dict.fromkeys(ids, '') + _columns = { 'name': fields.char('User Name', size=64, required=True, select=True, help="The new user's real name, used for searching" @@ -213,7 +216,7 @@ class users(osv.osv): 'login': fields.char('Login', size=64, required=True, help="Used to log into the system"), 'password': fields.char('Password', size=64, invisible=True, help="Keep empty if you don't want the user to be able to connect on the system."), - 'new_password': fields.function(lambda *a:'', method=True, type='char', size=64, + 'new_password': fields.function(_get_password, method=True, type='char', size=64, fnct_inv=_set_new_password, string='Change password', help="Only specify a value if you want to change the user password. " "This user will have to logout and login again!"), @@ -263,7 +266,6 @@ class users(osv.osv): if 'password' in o and ( 'id' not in o or o['id'] != uid ): o['password'] = '********' return o - result = super(users, self).read(cr, uid, ids, fields, context, load) canwrite = self.pool.get('ir.model.access').check(cr, uid, 'res.users', 'write', raise_exception=False) if not canwrite: @@ -535,15 +537,17 @@ class config_users(osv.osv_memory): 'email': base_data['email'], 'partner_id': partner_id,}, context) - user_data = dict( - base_data, - signature=self._generate_signature( - cr, base_data['name'], base_data['email'], context=context), - address_id=address, - ) + base_data.update({'menu_id' : base_data.get('menu_id',False) and base_data['menu_id'][0], + 'company_id' : base_data.get('company_id',False) and base_data['company_id'][0], + 'action_id' : base_data.get('action_id',False) and base_data['action_id'][0], + 'signature' : self._generate_signature(cr, base_data['name'], base_data['email'], context=context), + 'address_id' : address, + 'groups_id' : [(6,0, base_data.get('groups_id',[]))], + }) new_user = self.pool.get('res.users').create( - cr, uid, user_data, context) + cr, uid, base_data, context) self.send_welcome_email(cr, uid, new_user, context=context) + def execute(self, cr, uid, ids, context=None): 'Do nothing on execution, just launch the next action/todo' pass