Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py	(revision 15804)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py	(revision 15805)
@@ -108,5 +108,5 @@
     grok.context(IStudent)
     grok.name('get_matric_number')
-    grok.require('waeup.viewStudent')
+    grok.require('waeup.manageStudent')
 
     def update(self):
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15804)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15805)
@@ -194,4 +194,6 @@
         if next_integer == 0:
             return _('Matriculation number cannot be set.'), None
+        if not student.state in (RETURNING, PAID, REGISTERED, VALIDATED):
+            return _('Matriculation number cannot be set.'), None
         year = unicode(student.entry_session)[2:]
         return None, "%s/%06d" % (year, next_integer)
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py	(revision 15804)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py	(revision 15805)
@@ -36,5 +36,5 @@
     grok.context(IStudent)
     grok.view(StudentBaseDisplayFormPage)
-    grok.require('waeup.viewStudent')
+    grok.require('waeup.manageStudent')
     icon = 'actionicon_count.png'
     text = _('Get Matriculation Number')
