Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/applications.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/applications.py	(revision 12094)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/applications.py	(revision 12095)
@@ -29,5 +29,5 @@
 from waeup.ikoba.customers.interfaces import (
     IApplicationsContainer, ICustomerNavigation,
-    IApplication, ICustomersUtils,
+    IApplication, IApplicationEdit, ICustomersUtils,
     )
 from waeup.ikoba.customers.utils import generate_application_id
@@ -59,5 +59,5 @@
     """This is a customer application baseclass.
     """
-    grok.implements(IApplication, ICustomerNavigation)
+    grok.implements(IApplication, IApplicationEdit, ICustomerNavigation)
     grok.provides(IApplication)
     grok.baseclass()
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py	(revision 12094)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py	(revision 12095)
@@ -51,5 +51,5 @@
     ICustomer, ICustomersContainer, ICustomerRequestPW, ICustomersUtils,
     ICustomerDocument, ICustomerDocumentsContainer, ICustomerCreate,
-    ICustomerPDFDocument, IApplicationsContainer, IApplication
+    ICustomerPDFDocument, IApplicationsContainer, IApplication, IApplicationEdit
     )
 from waeup.ikoba.customers.catalog import search
@@ -1183,4 +1183,5 @@
     grok.name('edit')
     grok.require('waeup.handleCustomer')
+    form_fields = grok.AutoFields(IApplicationEdit).omit('last_transition_date')
 
     def update(self):
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py	(revision 12094)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py	(revision 12095)
@@ -290,4 +290,15 @@
         title = _(u'Product'),
         source = AppCatProductSource(),
-        required = True,
-        )
+        required = False,
+        )
+
+class IApplicationEdit(IApplication):
+    """Interface for editing application data by customers.
+
+    """
+
+    product = schema.Choice(
+        title = _(u'Product'),
+        source = AppCatProductSource(),
+        required = True,
+        )
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12094)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12095)
@@ -16,4 +16,5 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##
+import os
 import grok
 import shutil
@@ -167,2 +168,24 @@
         assert results[0] is self.customer['applications'][self.application_id]
         assert results[0].product is self.product
+
+    def test_product_removal(self):
+        # This test does not only test catalog components, it also ensures
+        # that the product attribute of an application is cleared
+        # but the last_product_id is not.
+        del self.app['products'][self.product_id]
+        self.assertTrue(self.application.product is None)
+        self.assertEqual(self.application.last_product_id, 'SAM')
+        cat = queryUtility(ICatalog, name='applications_catalog')
+        results = cat.searchResults(last_product_id=('SAM', 'SAM'))
+        results = [x for x in results]
+        assert len(results) == 1
+        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0].product is None
+        # Product removal is being logged in customers.log
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'customers.log')
+        logcontent = open(logfile).read()
+        self.assertTrue(
+            'INFO - system - ObjectRemovedEvent - K1000000 - a101 - removed: product\n'
+            in logcontent)
+
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py	(revision 12094)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/products/product.py	(revision 12095)
@@ -24,6 +24,7 @@
 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
 from zope.event import notify
+from zope.catalog.interfaces import ICatalog
 from zope.component import getUtility
-from zope.component.interfaces import IFactory
+from zope.component.interfaces import IFactory, ComponentLookupError
 from zope.interface import implementedBy
 from zope.i18n import translate
@@ -61,2 +62,26 @@
     def getInterfaces(self):
         return implementedBy(Product)
+
+@grok.subscribe(IProduct, grok.IObjectRemovedEvent)
+def handle_product_removed(product, event):
+    """If a product is deleted, we make sure that also referrers to
+    customer application objects are removed.
+    """
+    prodid = product.product_id
+
+    # Find all customer applications that refer to given product...
+    try:
+        cat = getUtility(ICatalog, name='applications_catalog')
+    except ComponentLookupError:
+        # catalog not available. This might happen during tests.
+        return
+    results = cat.searchResults(last_product_id=(prodid, prodid))
+    for application in results:
+        # Remove that referrer...
+        application.product = None
+        notify(grok.ObjectModifiedEvent(application))
+        application.customer.__parent__.logger.info(
+            'ObjectRemovedEvent - %s - %s - removed: product' % (
+                application.customer.customer_id, application.application_id))
+    return
+
