Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_move.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_move.py	(revision 12608)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_move.py	(revision 12609)
@@ -26,4 +26,63 @@
 
 class MoveObjectsInFaculties(StudentsFullSetup):
+
+    def test_move_department(self):
+        self.assertEqual(
+            self.app['faculties']['fac1']['dep1'].certificates['CERT1'],
+            self.certificate)
+        department = self.app['faculties']['fac1']['dep1']
+        faculty = self.app['faculties']['fac1']
+        department.moveDepartment('fac1', 'newdep')
+
+        # New department is created and old department is removed
+        self.assertEqual(
+            [key for key in self.app['faculties']['fac1']],
+            ['newdep'])
+
+        # All subobjects have been moved too
+        self.assertEqual(
+            self.app['faculties']['fac1']['newdep'].courses['COURSE1'],
+            self.course)
+        self.assertEqual(
+            self.app['faculties']['fac1']['newdep'].certificates['CERT1'],
+            self.certificate)
+        self.assertEqual(
+            [key for key in self.app['faculties']['fac1'][
+                'newdep'].certificates['CERT1'].keys()],
+            [u'COURSE1_100'])
+
+        # We can still find the certificate in the catalog
+        cat = queryUtility(ICatalog, name='certificates_catalog')
+        results = cat.searchResults(code=('CERT1','CERT1'))
+        results = [x for x in results] 
+        assert len(results) == 1
+        assert results[0] is self.certificate
+
+        # We can still find the course in the catalog
+        cat = queryUtility(ICatalog, name='courses_catalog')
+        results = cat.searchResults(code=('COURSE1','COURSE1'))
+        results = [x for x in results] #
+        assert len(results) == 1
+        assert results[0] is self.course
+        # We can still find the certificatecourse in the catalog
+        cat = queryUtility(ICatalog, name='certcourses_catalog')
+        results = cat.searchResults(course_code=('COURSE1','COURSE1'))
+        results = [x for x in results] 
+        assert len(results) == 1
+        assert results[0] is self.app['faculties']['fac1'][
+            'newdep'].certificates['CERT1']['COURSE1_100']
+
+        # We can find the student studying in the new department
+        cat = queryUtility(ICatalog, name='students_catalog')
+        results = cat.searchResults(depcode=('newdep','newdep'))
+        results = [x for x in results] # Turn results generator into list
+        assert len(results) == 1
+        assert results[0] is self.app['students'][self.student_id]
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'students.log')
+        logcontent = open(logfile).read()
+        self.assertTrue('INFO - system - K1000000 - Department moved'
+            in logcontent)
+
 
     def test_move_certificate(self):
@@ -70,3 +129,2 @@
         self.assertTrue('INFO - system - K1000000 - Certificate moved'
             in logcontent)
-
Index: /main/waeup.kofa/trunk/src/waeup/kofa/university/department.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/university/department.py	(revision 12608)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/university/department.py	(revision 12609)
@@ -20,4 +20,6 @@
 import grok
 import zope.location.location
+from zope.event import notify
+from zope.catalog.interfaces import ICatalog
 from zope.component.interfaces import IFactory
 from zope.interface import implementedBy
@@ -94,4 +96,24 @@
         return longtitle(self)
 
+    def moveDepartment(self, facname, depname):
+        """ Move department to new department named depname in
+        faculty named facname.
+
+        """
+        self.moved = True
+        fac = grok.getSite()['faculties'][facname]
+        oldcode = self.code
+        fac[depname] = self
+        del self.__parent__[oldcode]
+        fac[depname].code = depname
+        #self.__parent__._p_changed = True
+        cat = getUtility(ICatalog, name='students_catalog')
+        results = cat.searchResults(depcode=(oldcode, oldcode))
+        for student in results:
+            notify(grok.ObjectModifiedEvent(student))
+            student.__parent__.logger.info(
+                '%s - Department moved' % student.__name__)
+        return
+
 class DepartmentFactory(grok.GlobalUtility):
     """A factory for department containers.
