Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7026)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7027)
@@ -1265,6 +1265,33 @@
         return 'Bed Ticket %s' % self.context.getSessionString()
 
+class BedTicketSlipActionButton(ManageActionButton):
+    grok.context(IBedTicket)
+    grok.require('waeup.viewStudent')
+    icon = 'actionicon_pdf.png'
+    text = 'Download bed allocation slip'
+    target = 'bed_allocation.pdf'
+
+class ExportPDFBedTicketSlipPage(grok.View):
+    """Deliver a PDF slip of the context.
+    """
+    grok.context(IBedTicket)
+    grok.name('bed_allocation.pdf')
+    grok.require('waeup.viewStudent')
+    form_fields = grok.AutoFields(IBedTicket)
+    form_fields['booking_date'].custom_widget = FriendlyDateDisplayWidget('le')
+    prefix = 'form'
+
+    @property
+    def label(self):
+        return 'Bed Allocation %s' % self.context.bed_coordinates
+
+    def render(self):
+        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
+            self.request)
+        return renderPDF(self,'Bed Allocation', 'bed_allocation.pdf',
+            self.context.getStudent, studentview)
+
 class RelocateStudentActionButton(ManageActionButton):
-    grok.order(1)
+    grok.order(2)
     grok.context(IBedTicket)
     grok.view(BedTicketDisplayFormPage)
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 7026)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py	(revision 7027)
@@ -981,4 +981,5 @@
         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)
@@ -995,11 +996,14 @@
         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')
@@ -1009,4 +1013,10 @@
         self.assertMatches('...regular_male_fr...', self.browser.contents)
         self.assertMatches('...%s...' % pin, self.browser.contents)
+
+        # Students can open the pdf slip
+        self.browser.open(self.browser.url + '/bed_allocation.pdf')
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+
         # Students can't relocate themselves
         self.assertFalse('Relocate' in self.browser.contents)
@@ -1014,4 +1024,5 @@
         self.assertRaises(
             Unauthorized, self.browser.open, relocate_path)
+
         # Students can't the Remove button and check boxes
         self.browser.open(self.acco_student_path)
