Commit 80bf2f2a authored by Romain Courteaud's avatar Romain Courteaud

Modify Event and Ticket API.

They are now considered as Movement.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7315 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 827a0b45
......@@ -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 @@ class Event(Document):
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 @@ class Event(Document):
# 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
......@@ -32,7 +32,6 @@ from AccessControl import ClassSecurityInfo
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 @@ supported_decoding = {
}
class MailMessage(XMLObject, Event, CMFMailInMessage):
class MailMessage(Event, CMFMailInMessage):
"""
MailMessage subclasses Event objects to implement Email Events.
"""
......@@ -84,6 +83,8 @@ class MailMessage(XMLObject, Event, CMFMailInMessage):
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Event
, PropertySheet.MailMessage
)
......@@ -97,7 +98,7 @@ class MailMessage(XMLObject, Event, CMFMailInMessage):
# self.attachments = attachments
def _edit(self, *args, **kw):
XMLObject._edit(self, *args, **kw)
Event._edit(self, *args, **kw)
self.cleanMessage()
def cleanMessage(self):
......
......@@ -29,10 +29,9 @@
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
......@@ -41,10 +40,6 @@ class SaleOpportunity(MetaNode, XMLObject):
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
"""
......@@ -63,53 +58,9 @@ class SaleOpportunity(MetaNode, XMLObject):
, 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, )
}
)
}
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@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
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Romain Courteaud <romain@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')
##############################################################################
#
# 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@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
......@@ -33,15 +33,6 @@ class MailMessage:
"""
_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 @@ class MailMessage:
'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 @@ class MailMessage:
'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 @@ class MailMessage:
'acquisition_depends' : None,
'mode' : 'w' },
)
_categories = ( 'source', 'subordination', 'follow_up')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment