[Erp5-report] r7315 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 17 13:42:06 CEST 2006


Author: romain
Date: Wed May 17 13:42:03 2006
New Revision: 7315

URL: http://svn.erp5.org?rev=7315&view=rev
Log:
Modify Event and Ticket API.
They are now considered as Movement.

Added:
    erp5/trunk/products/ERP5/Document/Ticket.py
    erp5/trunk/products/ERP5/PropertySheet/Event.py
Modified:
    erp5/trunk/products/ERP5/Document/Event.py
    erp5/trunk/products/ERP5/Document/MailMessage.py
    erp5/trunk/products/ERP5/Document/SaleOpportunity.py
    erp5/trunk/products/ERP5/PropertySheet/MailMessage.py

Modified: erp5/trunk/products/ERP5/Document/Event.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Event.py?rev=7315&r1=7314&r2=7315&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Event.py (original)
+++ erp5/trunk/products/ERP5/Document/Event.py Wed May 17 13:42:03 2006
@@ -29,10 +29,10 @@
 from AccessControl import ClassSecurityInfo
 
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
-from Products.ERP5.Document.Document import Document
+from Products.ERP5.Document.Movement import Movement
 from Products.CMFCore.utils import getToolByName
 
-class Event(Document):
+class Event(Movement):
     """
       Event is the base class for all events in ERP5.
 
@@ -42,8 +42,6 @@
       of the interface between the ERP and third parties.
 
       Events have a start and stop date.
-
-      QUESTION : should we inherint from Document ?
     """
 
     meta_type = 'ERP5 Event'
@@ -57,8 +55,19 @@
 
     # Declarative properties
     property_sheets = ( PropertySheet.Base
+                      , PropertySheet.XMLObject
                       , PropertySheet.CategoryCore
                       , PropertySheet.DublinCore
                       , PropertySheet.Task
+                      , PropertySheet.Arrow
+                      , PropertySheet.Movement
+                      , PropertySheet.Event
                       )
 
+    def isAccountable(self):
+      """
+        Returns 1 if this needs to be accounted
+        Only account movements which are not associated to a delivery
+        Whenever delivery is there, delivery has priority
+      """
+      return 1

Modified: erp5/trunk/products/ERP5/Document/MailMessage.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/MailMessage.py?rev=7315&r1=7314&r2=7315&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/MailMessage.py (original)
+++ erp5/trunk/products/ERP5/Document/MailMessage.py Wed May 17 13:42:03 2006
@@ -32,7 +32,6 @@
 
 from Products.CMFMailIn.MailMessage import MailMessage as CMFMailInMessage
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
-from Products.ERP5Type.XMLObject import XMLObject
 from Products.CMFCore.WorkflowCore import WorkflowMethod
 
 from Products.ERP5.Document.Event import Event
@@ -63,7 +62,7 @@
   }
 
 
-class MailMessage(XMLObject, Event, CMFMailInMessage):
+class MailMessage(Event, CMFMailInMessage):
   """
     MailMessage subclasses Event objects to implement Email Events.
   """
@@ -84,6 +83,8 @@
                     , PropertySheet.DublinCore
                     , PropertySheet.Task
                     , PropertySheet.Arrow
+                    , PropertySheet.Movement
+                    , PropertySheet.Event
                     , PropertySheet.MailMessage
                     )
 
@@ -97,7 +98,7 @@
 #     self.attachments = attachments
 
   def _edit(self, *args, **kw):
-    XMLObject._edit(self, *args, **kw)
+    Event._edit(self, *args, **kw)
     self.cleanMessage()
 
   def cleanMessage(self):

Modified: erp5/trunk/products/ERP5/Document/SaleOpportunity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SaleOpportunity.py?rev=7315&r1=7314&r2=7315&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SaleOpportunity.py (original)
+++ erp5/trunk/products/ERP5/Document/SaleOpportunity.py Wed May 17 13:42:03 2006
@@ -29,23 +29,18 @@
 from AccessControl import ClassSecurityInfo
 
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
-from Products.ERP5.Core.MetaNode import MetaNode
-from Products.ERP5Type.XMLObject import XMLObject
+from Products.ERP5.Document.Ticket import Ticket
 
-class SaleOpportunity(MetaNode, XMLObject):
+class SaleOpportunity(Ticket):
     """
-      A SalesOpportunity allows to track a sales process involving
-      multilple Person and Organisations. It is a placeholder for
-      documents, events, etc.
+    A SalesOpportunity allows to track a sales process involving
+    multilple Person and Organisations. It is a placeholder for
+    documents, events, etc.
 
-      SalesOpportunity objects can be synchronized accross
-      multiple sites
+    SalesOpportunity objects can be synchronized accross
+    multiple sites
 
-      It can be considered as a MetaNode in the ERP5 UBM model since
-      it may be necessary to account the investment in a given sales
-      opportunity.
-      
-      XXX Must be renamed to Opportunity
+    XXX Must be renamed to Opportunity
     """
 
     meta_type = 'ERP5 Sale Opportunity'
@@ -63,53 +58,9 @@
                       , PropertySheet.XMLObject
                       , PropertySheet.CategoryCore
                       , PropertySheet.DublinCore
-                      , PropertySheet.SaleOpportunity  # Useless, replace by Arrow
+                      # Useless, replace by Arrow
+                      , PropertySheet.SaleOpportunity  
                       , PropertySheet.Arrow
                       , PropertySheet.Price
+                      , PropertySheet.Movement
                       )
-
-    # Factory Type Information
-    factory_type_information = \
-      {    'id'             : portal_type
-         , 'meta_type'      : meta_type
-         , 'description'    : """\
-A SalesOpportunity allows to track a sales process involving
-multilple Person and Organisations. It is a placeholder for
-documents, events, etc."""
-         , 'icon'           : 'sale_opportunity_icon.gif'
-         , 'product'        : 'ERP5'
-         , 'factory'        : 'addSaleOpportunity'
-         , 'immediate_view' : 'sale_opportunity_edit'
-         , 'actions'        :
-        ( { 'id'            : 'view'
-          , 'name'          : 'View'
-          , 'category'      : 'object_view'
-          , 'action'        : 'sale_opportunity_edit'
-          , 'permissions'   : (
-              Permissions.View, )
-          }
-        , { 'id'            : 'print'
-          , 'name'          : 'Print'
-          , 'category'      : 'object_print'
-          , 'action'        : 'sale_opportunity_print'
-          , 'permissions'   : (
-              Permissions.View, )
-          }
-        , { 'id'            : 'metadata'
-          , 'name'          : 'Metadata'
-          , 'category'      : 'object_edit'
-          , 'action'        : 'metadata_edit'
-          , 'permissions'   : (
-              Permissions.View, )
-          }
-        , { 'id'            : 'translate'
-          , 'name'          : 'Translate'
-          , 'category'      : 'object_action'
-          , 'action'        : 'translation_template_view'
-          , 'permissions'   : (
-              Permissions.TranslateContent, )
-          }
-        )
-      }
-
-

Added: erp5/trunk/products/ERP5/Document/Ticket.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Ticket.py?rev=7315&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/Document/Ticket.py (added)
+++ erp5/trunk/products/ERP5/Document/Ticket.py Wed May 17 13:42:03 2006
@@ -1,0 +1,71 @@
+##############################################################################
+#
+# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
+#                    Jean-Paul Smets-Solanes <jp at nexedi.com>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+from AccessControl import ClassSecurityInfo
+
+from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
+from Products.ERP5.Document.Movement import Movement
+
+class Ticket(Movement):
+    """
+    A Ticket allows to track a sales process involving
+    multilple Person and Organisations. It is a placeholder for
+    documents, events, etc.
+    """
+
+    meta_type = 'ERP5 Ticket'
+    portal_type = 'Ticket'
+    add_permission = Permissions.AddPortalContent
+    isPortalContent = 1
+    isRADContent = 1
+
+    # Declarative security
+    security = ClassSecurityInfo()
+    security.declareObjectProtected(Permissions.AccessContentsInformation)
+
+    # Declarative properties
+    property_sheets = ( PropertySheet.Base
+                      , PropertySheet.XMLObject
+                      , PropertySheet.CategoryCore
+                      , PropertySheet.DublinCore
+                      # Useless, replace by Arrow
+                      , PropertySheet.SaleOpportunity  
+                      , PropertySheet.Arrow
+                      , PropertySheet.Price
+                      , PropertySheet.Movement
+                      )
+
+    security.declareProtected(Permissions.AccessContentsInformation, 
+                              'isAccountable')
+    def isAccountable(self):
+      """
+        Returns 1 if this needs to be accounted
+        Only account movements which are not associated to a delivery
+        Whenever delivery is there, delivery has priority
+      """
+      return 1

Added: erp5/trunk/products/ERP5/PropertySheet/Event.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/Event.py?rev=7315&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/Event.py (added)
+++ erp5/trunk/products/ERP5/PropertySheet/Event.py Wed May 17 13:42:03 2006
@@ -1,0 +1,69 @@
+##############################################################################
+#
+# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
+#                    Jean-Paul Smets-Solanes <jp at nexedi.com>
+#                    Romain Courteaud <romain at nexedi.com>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+
+class Event:
+    """
+    Event properties and categories
+    """
+
+    _properties = (
+        # XXX Copy/Paste from ERP5/PropertySheet/Order.py
+        { 'id'          : 'received_date',
+          'description' : 'Received date',
+          'type'        : 'date',
+          'mode'        : 'w' },
+       # Source properties
+        { 'id'          : 'organisation_title',
+          'description' : 'The organisations this persons works for',
+          'type'        : 'string',
+          'acquisition_base_category' : ('subordination',),
+          'acquisition_portal_type'   : ('Organisation',),
+          'acquisition_copy_value'    : 0,
+          'acquisition_mask_value'    : 0,
+          'acquisition_sync_value'    : 0,
+          'acquisition_accessor_id'   : 'getTitle',
+          'acquisition_depends'       : None,
+          'mode'        : 'w' },
+        # Source properties
+        { 'id'          : 'person_title',
+          'description' : 'The person this event come from',
+          'type'        : 'string',
+          'acquisition_base_category' : ('source',),
+          'acquisition_portal_type'   : ('Person',),
+          'acquisition_copy_value'    : 0,
+          'acquisition_mask_value'    : 0,
+          'acquisition_sync_value'    : 0,
+          'acquisition_accessor_id'   : 'getTitle',
+          'acquisition_depends'       : None,
+          'mode'        : 'w' },
+        )
+
+    # XXX Source, Destination are duplicated...
+    _categories = ('source', 'destination', 'subordination', 'follow_up')

Modified: erp5/trunk/products/ERP5/PropertySheet/MailMessage.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/MailMessage.py?rev=7315&r1=7314&r2=7315&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/MailMessage.py (original)
+++ erp5/trunk/products/ERP5/PropertySheet/MailMessage.py Wed May 17 13:42:03 2006
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2002, 2006 Nexedi SARL and Contributors. All Rights Reserved.
 #                    Jean-Paul Smets-Solanes <jp at nexedi.com>
 #
 # WARNING: This program as such is intended to be used by professional
@@ -29,19 +29,10 @@
 
 class MailMessage:
     """
-        MailMessage properties and categories
+    MailMessage properties and categories
     """
 
     _properties = (
-        {   'id'          : 'subject',
-            'description' : 'Mail subject, extracted from header.',
-            'type'        : 'string',
-            'default'     : '',
-            'mode'        : 'w' },
-        {   'id'          : 'date',
-            'description' : 'Mail send date, extracted from header.',
-            'type'        : 'string',
-            'mode'        : 'w' },
         {   'id'          : 'to',
             'description' : 'Destination email address, extracted from header.',
             'type'        : 'string',
@@ -66,7 +57,20 @@
             'description' : '',
             'type'        : 'string',
             'mode'        : 'w' },
-       # Source properties
+        {   'id'          : 'original',
+            'description' : 'Save raw mail received from MTA',
+            'type'        : 'string',
+            'mode'        : 'w' },
+        # Kept for compatibility
+        {   'id'          : 'date',
+            'description' : 'Mail send date, extracted from header.',
+            'type'        : 'string',
+            'mode'        : 'w' },
+        {   'id'          : 'subject',
+            'description' : 'Mail subject, extracted from header.',
+            'type'        : 'string',
+            'default'     : '',
+            'mode'        : 'w' },
         { 'id'          : 'organisation_title',
           'description' : 'The organisations this persons works for',
           'type'        : 'string',
@@ -78,7 +82,6 @@
           'acquisition_accessor_id'   : 'getTitle',
           'acquisition_depends'       : None,
           'mode'        : 'w' },
-        # Source properties
         { 'id'          : 'person_title',
           'description' : 'The person this mail come from',
           'type'        : 'string',
@@ -91,6 +94,3 @@
           'acquisition_depends'       : None,
           'mode'        : 'w' },
         )
-
-    _categories = ( 'source', 'subordination', 'follow_up')
-




More information about the Erp5-report mailing list