Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7016)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7017)
@@ -1032,5 +1032,5 @@
     title = 'Accommodation'
     pnav = 4
-    officers_only_actions = ['delBedTickets']
+    officers_only_actions = ['Remove selected']
 
     def formatDatetime(self,datetimeobj):
@@ -1049,6 +1049,16 @@
         return
 
+    @property
+    def is_student(self):
+        prm = get_principal_role_manager()
+        roles = [x[0] for x in prm.getRolesForPrincipal(self.request.principal.id)]
+        return 'waeup.Student' in roles
+
     @grok.action('Remove selected')
     def delBedTickets(self, **data):
+        if self.is_student:
+            self.flash('You are not allowed to remove bed tickets.')
+            self.redirect(self.url(self.context))
+            return
         form = self.request.form
         if form.has_key('val_id'):
@@ -1074,15 +1084,10 @@
         return
 
-    def isStudent(self):
-        prm = get_principal_role_manager()
-        roles = [x[0] for x in prm.getRolesForPrincipal(self.request.principal.id)]
-        return 'waeup.Student' in roles
-
     @property
     def selected_actions(self):
         sa = self.actions
-        if self.isStudent():
+        if self.is_student:
             sa = [action for action in self.actions
-                  if not action in officers_only_actions]
+                  if not action.label in self.officers_only_actions]
         return sa
 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/accommodationmanagepage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/accommodationmanagepage.pt	(revision 7016)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/accommodationmanagepage.pt	(revision 7017)
@@ -18,5 +18,5 @@
     <thead>
     <tr>
-      <th>&nbsp;</th>
+      <th tal:condition="not: view/is_student">&nbsp;</th>
       <th>Session</th>
       <th>Booking Date</th>
@@ -27,5 +27,5 @@
     <tbody>
       <tr tal:repeat="cl context/values">
-         <td>
+         <td tal:condition="not: view/is_student">
           <input type="checkbox"
     		 name="val_id"
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py	(revision 7016)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py	(revision 7017)
@@ -751,5 +751,5 @@
 
     def test_student_payments(self):
-        # Set up SessionConfiguration object
+        # Login
         self.browser.open(self.login_path)
         self.browser.getControl(name="form.login").value = self.student_id
@@ -915,3 +915,63 @@
 
     def test_student_accommodation(self):
-        return
+        # Login
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+
+        # Students can add online booking fee payment tickets and open the
+        # callback view (see test_manage_payments)
+        self.browser.getLink("Payments").click()
+        self.browser.getControl("Add online payment ticket").click()
+        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
+        self.browser.getControl("Create ticket").click()
+        ctrl = self.browser.getControl(name='val_id')
+        value = ctrl.options[0]
+        self.browser.getLink(value).click()
+        self.browser.open(self.browser.url + '/callback')
+        # The new HOS-0 pin has been created
+        self.assertEqual(len(self.app['accesscodes']['HOS-0']),1)
+        pin = self.app['accesscodes']['HOS-0'].keys()[0]
+        ac = self.app['accesscodes']['HOS-0'][pin]
+        ac.owner = self.student_id
+        parts = pin.split('-')[1:]
+        sfeseries, sfenumber = parts
+        # Students can use HOS code and book a bed space with it
+        self.browser.open(self.acco_student_path)
+        self.browser.getLink("Book accommodation").click()
+        self.assertMatches('...You are in the wrong...',
+                           self.browser.contents)
+        IWorkflowInfo(self.student).fireTransition('admit')
+        self.browser.getLink("Book accommodation").click()
+        self.assertMatches('...Activation Code:...',
+                           self.browser.contents)
+        self.browser.getControl(name="ac_series").value = sfeseries
+        self.browser.getControl(name="ac_number").value = sfenumber
+        self.browser.getControl("Create bed ticket").click()
+        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
+                           self.browser.contents)
+        # Bed has been allocated
+        bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
+        self.assertTrue(bed.owner == self.student_id)
+        # BedTicketAddPage is now blocked
+        self.browser.getLink("Book accommodation").click()
+        self.assertMatches('...You already booked a bed space...',
+            self.browser.contents)
+        # The bed ticket displays the data correctly
+        self.browser.open(self.acco_student_path + '/2004')
+        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
+                           self.browser.contents)
+        self.assertMatches('...2004/2005...', self.browser.contents)
+        self.assertMatches('...regular_male_fr...', self.browser.contents)
+        self.assertMatches('...%s...' % pin, self.browser.contents)
+        # Students can't relocate themselves
+        self.assertFalse('Relocate' in self.browser.contents)
+        relocate_path = self.acco_student_path + '/2004/relocate'
+        self.assertRaises(
+            Unauthorized, self.browser.open, relocate_path)
+        # Students can't the Remove button and check boxes
+        self.browser.open(self.acco_student_path)
+        self.assertFalse('Remove' in self.browser.contents)
+        self.assertFalse('val_id' in self.browser.contents)
+        return
