Commit 36420d5c authored by Jérome Perrin's avatar Jérome Perrin

Fix class hierarchy for nodes

MetaNodes have always been Organisations, but this does not make sense at all.
This change reveal some hidden bugs with code that was working accidentally
because all meta nodes, such as categories use to be organisations and have all
the accessors from organisations
parent ead985a7
......@@ -29,38 +29,30 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.Node import Node
#from Products.ERP5.Core.MetaNode import MetaNode
class Account(Node):
"""An account is an abstract node which holds currencies and is used in
accounting.
#class Account(MetaNode, XMLObject):
class Account(XMLObject):
"""
An account is an abstract metanode which holds
currencies. Accounting is implemented through
categories. For example, a sales movement may be
written:
Resource: EUR
Amount: 200
source/compte/produit
destination/compte/client
client/auchan
section/coramy
A purchase movement is written:
Resource: EUR
Amount: 200
source/compte/charge
destination/compte/fournisseur
fournisseur/coramy
section/auchan
Sections allow to implement simple analytical accounting.
(at the present stage, category membership is boolean logics.
at some point, category membership should become fuzzy logics)
Accounts are member of categories that are used to do aggregated reporting
of accounting movements. Typically, the following categories are used::
* GAP: This category represents the classification as defined by the
legislations that the organisatation have to comply to. Accounts can be
associated to multiple GAP category trees at the same time, and
therefore it allows to generate reports for multiple legislations from
the same accounting data.
* Financial Section: This category is the representation of the financial
structure as seen by the company, regardless of the fiscal
requirements. Balance Sheets and Profit & Loss reports can be
generated using those categories.
* Account Type: This category is used to describe what is the type of
this account, and usually has impact on the behaviour of the
application and reportings. For instance, when using a "payable"
account in an accounting transaction, we set the supplier organisation
as mirror section, and reports such as trial balance can display a
breakdown of this account for each supplier.
"""
meta_type = 'ERP5 Account'
......
......@@ -30,11 +30,10 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5.Document.Node import Node
from Products.ERP5.Document.Coordinate import Coordinate
from Products.ERP5.Document.MetaNode import MetaNode
class BankAccount(Folder, Coordinate, MetaNode):
class BankAccount(Node, Coordinate):
"""
A bank account number holds a collection of numbers and codes
(ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
......@@ -42,8 +41,6 @@ class BankAccount(Folder, Coordinate, MetaNode):
A Bank Account is owned by a Person or an Organisation. A Bank Account
contain Agents with Agent Privileges used by the owner to delegate the
management of the bank account to trusted third-party Persons.
BankAccount inherits from Base and from the mix-in Coordinate.
"""
meta_type = 'ERP5 Bank Account'
......
......@@ -37,6 +37,7 @@ from Products.ERP5.Document.Movement import Movement
class BudgetCell(Predicate, MetaNode, Movement):
""" Budget Cell defines a cell of budget.
XXX This is not a Movement, but we need getDestinationCredit
XXX This is not a MetaNode
"""
# Default Properties
......
......@@ -29,7 +29,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Organisation import Organisation as Node
from Products.ERP5.Document.Node import Node
from Products.CMFCore.utils import getToolByName
class MetaNode(Node):
......
##############################################################################
#
# Copyright (c) 2002 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.
#
##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
class Node(XMLObject):
"""Node base class.
See interfaces.INode.
"""
meta_type = 'ERP5 Node'
portal_type = 'Node'
add_permission = Permissions.AddPortalContent
zope.interface.implements(interfaces.INode)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Reference
)
......@@ -32,11 +32,9 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
#from Products.ERP5.Core.MetaNode import MetaNode
#from Products.ERP5.Document.MetaNode import MetaNode
from Products.ERP5.Document.Node import Node
#class Organisation(MetaNode, XMLObject):
class Organisation(XMLObject):
class Organisation(Node):
"""
An Organisation object holds the information about
an organisation (ex. a division in a company, a company,
......
......@@ -30,9 +30,9 @@
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.mixin.encrypted_password import EncryptedPasswordMixin
from Products.ERP5.Document.Node import Node
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5.mixin.encrypted_password import EncryptedPasswordMixin
from Products.ERP5.mixin.login_account_provider import LoginAccountProviderMixin
try:
......@@ -41,8 +41,7 @@ try:
except ImportError:
PluggableAuthService = None
#class Person(Node, XMLObject):
class Person(LoginAccountProviderMixin, EncryptedPasswordMixin, XMLObject):
class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin):
"""
An Person object holds the information about
an person (ex. you, me, someone in the company,
......
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