Description: Migration for obsolete modules
 The server fails to start with a missing module, so we remove them
 from the modules table.
 Server module workflow was removed in version 2.4.
 tryton-modules-ldap-connection was merged into
 tryton-modules-ldap-authentication in version 3.4.
Author: Mathias Behrle <mathiasb@m9s.biz>
Bug: http://bugs.tryton.org/issue4280
Forwarded: https://bugs.tryton.org/issue4280

--- a/trytond/modules/__init__.py
+++ b/trytond/modules/__init__.py
@@ -367,6 +367,16 @@
                         where=ir_module.state == 'uninstalled'))
 
             if update:
+                # Migration from 3.2:
+                # module ldap_connection removed
+                # Migration from 4.4:
+                # modules webdav party_vcarddav calendar calendar_classification
+                # calendar_todo calendar_scheduling removed
+                obsolete_modules = ['ldap_connection', 'webdav',
+                    'party_vcarddav', 'calendar', 'calendar_classification',
+                    'calendar_todo', 'calendar_scheduling']
+                cursor.execute(*ir_module.delete(
+                        where=(ir_module.name.in_(obsolete_modules))))
                 cursor.execute(*ir_module.select(ir_module.name,
                         where=ir_module.state.in_(('activated', 'to activate',
                                 'to upgrade', 'to remove'))))
