Commit da507a2c authored by Jérome Perrin's avatar Jérome Perrin

Fix class hierarchy for Project, it should not be an Order, as it is a Node.

Inherit from XMLMatrix, it can be required for project implementations to use matrix for project.
Create INode interface and associate it to common node classes.
Update a few docstrings.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32317 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82817565
......@@ -26,6 +26,7 @@
#
##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
......@@ -55,6 +56,8 @@ class Organisation(XMLObject):
portal_type = 'Organisation'
add_permission = Permissions.AddPortalContent
zope.interface.implements(interfaces.INode)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
......@@ -27,6 +27,7 @@
#
##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _checkPermission
......@@ -79,6 +80,8 @@ class Person(XMLObject):
portal_type = 'Person'
add_permission = Permissions.AddPortalContent
zope.interface.implements(interfaces.INode)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002 nSight SAS and Contributors. All Rights Reserved.
# Nicolas Lhoir <nicolas.lhoir@nsight.fr>
# 2010 Nexedi SA and Contributors. All Rights Reserved.
# Jérome Perrin <jerome@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
......@@ -26,11 +29,14 @@
#
##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
from Products.ERP5.Document.Order import Order
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.XMLMatrix import XMLMatrix
class Project(Order):
class Project(XMLObject, XMLMatrix):
"""
Project is a class which describes a typical project in consulting firm.
A project has a client, an invoiced client. A project has also a start
......@@ -39,14 +45,15 @@ class Project(Order):
Each task has a person to perform it, a certain amount of time, a date,
a place, a description. For each person and each task, there is dedicated
time rate.
XXX Project should not inherit from Order since Task exists.
This is not a Delivery
"""
meta_type = 'ERP5 Project'
portal_type = 'Project'
add_permission = Permissions.AddPortalContent
# XXX to index start_date and stop_date in delivery table:
isDelivery = ConstantGetter('isDelivery', value=True)
zope.interface.implements(interfaces.INode)
# Declarative security
security = ClassSecurityInfo()
......
......@@ -78,9 +78,6 @@ class Ticket(Movement, Project):
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
""" Tickets are accountable.
"""
return 1
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#
# 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.
#
##############################################################################
"""
Products.ERP5.interfaces.node
"""
from zope.interface import Interface
class INode(Interface):
""" Node Interface.
A node is a place which can receive amounts of resources and send amounts of
resources. Nodes can relate to physical entities (ex. a workshop which
receives raw material, processes it and sends it) or abstract entities (ex. a
bank account which can receive money). Stocks are a kind of Node.
"""
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