[FIX] base: correct non-copy of `login_date` + adapt tests
This commit is contained in:
parent
e2e60bf4eb
commit
a3704beefb
|
@ -163,7 +163,7 @@ class res_users(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'id': fields.integer('ID'),
|
||||
'login_date': fields.date('Latest connection', select=1),
|
||||
'login_date': fields.date('Latest connection', select=1, copy=False),
|
||||
'partner_id': fields.many2one('res.partner', required=True,
|
||||
string='Related Partner', ondelete='restrict',
|
||||
help='Partner-related data of the user', auto_join=True),
|
||||
|
@ -373,12 +373,6 @@ class res_users(osv.osv):
|
|||
default['login'] = _("%s (copy)") % user2copy['login']
|
||||
return super(res_users, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def copy_data(self, cr, uid, ids, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default.update({'login_date': False})
|
||||
return super(res_users, self).copy_data(cr, uid, ids, default, context=context)
|
||||
|
||||
@tools.ormcache(skiparg=2)
|
||||
def context_get(self, cr, uid, context=None):
|
||||
user = self.browse(cr, SUPERUSER_ID, uid, context)
|
||||
|
|
|
@ -226,7 +226,7 @@ class TestInherits(common.TransactionCase):
|
|||
def test_copy_with_ancestor(self):
|
||||
""" copying a user with 'parent_id' in defaults should not duplicate the partner """
|
||||
foo_id = self.user.create(self.cr, UID, {'name': 'Foo', 'login': 'foo', 'password': 'foo',
|
||||
'login_date': '2016-01-01'})
|
||||
'login_date': '2016-01-01', 'signature': 'XXX'})
|
||||
par_id = self.partner.create(self.cr, UID, {'name': 'Bar'})
|
||||
|
||||
foo_before, = self.user.read(self.cr, UID, [foo_id])
|
||||
|
@ -244,8 +244,9 @@ class TestInherits(common.TransactionCase):
|
|||
self.assertNotEqual(foo.id, bar.id)
|
||||
self.assertEqual(bar.partner_id.id, par_id)
|
||||
self.assertEqual(bar.login, 'bar', "login is given from copy parameters")
|
||||
self.assertEqual(bar.login_date, foo.login_date, "login_date copied from original record")
|
||||
self.assertFalse(bar.login_date, "login_date should not be copied from original record")
|
||||
self.assertEqual(bar.name, 'Bar', "name is given from specific partner")
|
||||
self.assertEqual(bar.signature, foo.signature, "signature should be copied")
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue