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 @@ ...@@ -29,38 +29,30 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet 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): Accounts are member of categories that are used to do aggregated reporting
class Account(XMLObject): of accounting movements. Typically, the following categories are used::
""" * GAP: This category represents the classification as defined by the
An account is an abstract metanode which holds legislations that the organisatation have to comply to. Accounts can be
currencies. Accounting is implemented through associated to multiple GAP category trees at the same time, and
categories. For example, a sales movement may be therefore it allows to generate reports for multiple legislations from
written: the same accounting data.
* Financial Section: This category is the representation of the financial
Resource: EUR structure as seen by the company, regardless of the fiscal
Amount: 200 requirements. Balance Sheets and Profit & Loss reports can be
source/compte/produit generated using those categories.
destination/compte/client * Account Type: This category is used to describe what is the type of
client/auchan this account, and usually has impact on the behaviour of the
section/coramy application and reportings. For instance, when using a "payable"
account in an accounting transaction, we set the supplier organisation
A purchase movement is written: as mirror section, and reports such as trial balance can display a
breakdown of this account for each supplier.
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)
""" """
meta_type = 'ERP5 Account' meta_type = 'ERP5 Account'
......
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet 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.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 A bank account number holds a collection of numbers and codes
(ex. SWIFT, RIB, etc.) which may be used to identify a bank account. (ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
...@@ -42,8 +41,6 @@ class BankAccount(Folder, Coordinate, MetaNode): ...@@ -42,8 +41,6 @@ class BankAccount(Folder, Coordinate, MetaNode):
A Bank Account is owned by a Person or an Organisation. A Bank Account 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 contain Agents with Agent Privileges used by the owner to delegate the
management of the bank account to trusted third-party Persons. 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' meta_type = 'ERP5 Bank Account'
......
...@@ -37,6 +37,7 @@ from Products.ERP5.Document.Movement import Movement ...@@ -37,6 +37,7 @@ from Products.ERP5.Document.Movement import Movement
class BudgetCell(Predicate, MetaNode, Movement): class BudgetCell(Predicate, MetaNode, Movement):
""" Budget Cell defines a cell of budget. """ Budget Cell defines a cell of budget.
XXX This is not a Movement, but we need getDestinationCredit XXX This is not a Movement, but we need getDestinationCredit
XXX This is not a MetaNode
""" """
# Default Properties # Default Properties
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet 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 from Products.CMFCore.utils import getToolByName
class MetaNode(Node): 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 ...@@ -32,11 +32,9 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
#from Products.ERP5.Core.MetaNode import MetaNode from Products.ERP5.Document.Node import Node
#from Products.ERP5.Document.MetaNode import MetaNode
#class Organisation(MetaNode, XMLObject): class Organisation(Node):
class Organisation(XMLObject):
""" """
An Organisation object holds the information about An Organisation object holds the information about
an organisation (ex. a division in a company, a company, an organisation (ex. a division in a company, a company,
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5.Document.Node import Node
from Products.ERP5.mixin.encrypted_password import EncryptedPasswordMixin
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5.mixin.encrypted_password import EncryptedPasswordMixin
from Products.ERP5.mixin.login_account_provider import LoginAccountProviderMixin from Products.ERP5.mixin.login_account_provider import LoginAccountProviderMixin
try: try:
...@@ -41,8 +41,7 @@ try: ...@@ -41,8 +41,7 @@ try:
except ImportError: except ImportError:
PluggableAuthService = None PluggableAuthService = None
#class Person(Node, XMLObject): class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin):
class Person(LoginAccountProviderMixin, EncryptedPasswordMixin, XMLObject):
""" """
An Person object holds the information about An Person object holds the information about
an person (ex. you, me, someone in the company, 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