'Verify that accessing deleted records works as expected'

@mute_logger('odoo.models')
def test_access_deleted_records(self):

    p1 = self.env['res.partner'].create({'name': 'W'})
    p2 = self.env['res.partner'].create({'name': 'Y'})
    p1.unlink()
    user = self.env['res.users'].create({'name': 'test    user', 'login': 'test2', 'groups_id': [4, self.ref('base.group_user')]})
    ps = (p1 + p2).sudo(user)
    self.assertEqual([{'id': p2.id, 'name': 'Y'}], ps.read(['name']), 'read()    should    skip    deleted    records')
    self.assertEqual([], ps[0].read(['name']), 'read()    should    skip    deleted    records')
    self.assertTrue(p1.unlink(), 'Re-deleting    should    be    a    no-op')
    with self.assertRaises(MissingError):
        p1.write({'name': 'foo'})
