|
@ -1,4 +1,5 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
"""Extend res.users to be compatible with split name in res.partner.""" |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
# |
|
|
# |
|
|
# Author: Nicolas Bessi. Copyright Camptocamp SA |
|
|
# Author: Nicolas Bessi. Copyright Camptocamp SA |
|
@ -17,14 +18,19 @@ |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
from openerp.osv import orm |
|
|
|
|
|
|
|
|
from openerp import api, models |
|
|
from openerp.tools.translate import _ |
|
|
from openerp.tools.translate import _ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResUsers(orm.Model): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResUsers(models.Model): |
|
|
|
|
|
"""Extend res.users to be compatible with split name in res.partner.""" |
|
|
_inherit = 'res.users' |
|
|
_inherit = 'res.users' |
|
|
|
|
|
|
|
|
|
|
|
@api.onchange('firstname', 'lastname') |
|
|
|
|
|
def change_name(self): |
|
|
|
|
|
names = [name for name in [self.firstname, self.lastname] if name] |
|
|
|
|
|
self.name = ' '.join(names) |
|
|
|
|
|
|
|
|
def copy_data(self, cr, uid, _id, default=None, context=None): |
|
|
def copy_data(self, cr, uid, _id, default=None, context=None): |
|
|
""" |
|
|
""" |
|
|
Avoid to replicate the firstname into the name when duplicating a user |
|
|
Avoid to replicate the firstname into the name when duplicating a user |
|
|