From 12db67c0ce54c96957fb3b19d4400381feb3a75f Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sun, 8 Nov 2009 17:25:10 +0000
Subject: [PATCH] Deliveries  can act as IDivergenceController

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30410 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Delivery.py     | 13 ++++++++++++-
 product/ERP5/Document/DeliveryCell.py |  5 +++++
 product/ERP5/Document/DeliveryLine.py |  4 +++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py
index 8aafd469cf..997fd23ba1 100644
--- a/product/ERP5/Document/Delivery.py
+++ b/product/ERP5/Document/Delivery.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -27,10 +28,12 @@
 #
 ##############################################################################
 
+import zope.interface
+
 from Products.CMFCore.utils import getToolByName
 from Products.ERP5Type.Base import WorkflowMethod
 from AccessControl import ClassSecurityInfo
-from Products.ERP5Type import Permissions, PropertySheet
+from Products.ERP5Type import Permissions, PropertySheet, interfaces
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery
 from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
@@ -67,6 +70,9 @@ class Delivery(XMLObject, ImmobilisationDelivery):
                       , PropertySheet.Price
                       )
 
+    # Declarative interfaces
+    zope.interface.implements(interfaces.IDivergenceController,)
+
     security.declareProtected(Permissions.AccessContentsInformation, 'isAccountable')
     def isAccountable(self):
       """
@@ -865,6 +871,11 @@ class Delivery(XMLObject, ImmobilisationDelivery):
     def getBuilderList(self):
       """Returns appropriate builder list."""
       return self._getTypeBasedMethod('getBuilderList')()
+      # XXX - quite a hack, since no way to know...
+      #       propper implementation should use business path definition
+      #       however, the real question is "is this really necessary"
+      #       since the main purpose of this method is superceded
+      #       by IDivergenceController
 
     def getRuleReference(self):
       """Returns an appropriate rule reference."""
diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py
index 7d4516cba4..ab4eba390e 100644
--- a/product/ERP5/Document/DeliveryCell.py
+++ b/product/ERP5/Document/DeliveryCell.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002, 2004 Nexedi SARL and Contributors. All Rights Reserved.
@@ -27,6 +28,8 @@
 #
 ##############################################################################
 
+import zope.interface
+
 from Products.ERP5Type.Globals import InitializeClass, PersistentMapping
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base
@@ -69,6 +72,8 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement):
                       , PropertySheet.ItemAggregation
                       )
 
+    # Declarative interfaces
+    zope.interface.implements(interfaces.IDivergenceController,)
     
     # MatrixBox methods      
     security.declareProtected( Permissions.AccessContentsInformation,
diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py
index f81c09e8e2..87958999b6 100644
--- a/product/ERP5/Document/DeliveryLine.py
+++ b/product/ERP5/Document/DeliveryLine.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
@@ -68,7 +69,8 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated,
                       , PropertySheet.SortIndex
                       )
 
-    #zope.interface.implements(interfaces.IDivergenceSolver,)
+    # Declarative interfaces
+    zope.interface.implements(interfaces.IDivergenceController,)
 
     # Multiple inheritance definition
     updateRelatedContent = XMLMatrix.updateRelatedContent
-- 
2.30.9