Commit c46bc7d8 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Initial revision


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5828 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3283b7fc
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@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 ExtensionClass
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ERP5Type.Accessor.Base import Method, func_code
from Products.ERP5Type.Utils import convertToMixedCase, convertToUpperCase
from Globals import InitializeClass
class BaobabGetter(Method):
"""Get a category differently
"""
_need__name__ = 1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
def __init__(self, id, method_id):
self._id = id
self.__name__ = id
self._method_id = method_id
def __call__(self, instance, *args, **kw):
portal_type = instance.getPortalType()
skin_id = '%s_%s' % (portal_type.replace(' ', ''), self._id)
skin = getattr(instance, skin_id, None)
if skin is not None:
return skin(*args, **kw)
return getattr(instance, self._method_id)(*args, **kw)
class BaobabValueGetter(Method):
"""Get the value of a baobab category
"""
_need__name__ = 1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
def __init__(self, id, method_id):
self._id = id
self.__name__ = id
self._method_id = method_id
def __call__(self, instance, *args, **kw):
category = getattr(instance, self._method_id)(*args, **kw)
if category is not None:
return instance.portal_categories.resolveCategory(category)
class BaobabPropertyGetter(Method):
"""Get the property of a baobab category
"""
_need__name__ = 1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
def __init__(self, id, method_id, property_id):
self._id = id
self.__name__ = id
self._method_id = method_id
self._property_id = property_id
def __call__(self, instance, *args, **kw):
value = getattr(instance, self._method_id)(*args, **kw)
if value is not None:
return value.getProperty(self._property_id, *args, **kw)
class BaobabMixin(ExtensionClass.Base):
"""This class provides different ways to access source, destination, etc.
"""
security = ClassSecurityInfo()
for category in ('source', 'destination',
'source_section', 'destination_section',
'source_payment', 'destination_payment',
'source_function', 'destination_function',
'source_project', 'destination_project'):
getter_id = 'getBaobab%s' % (convertToUpperCase(category))
original_getter_id = 'get%s' % (convertToUpperCase(category))
method = BaobabGetter(getter_id, original_getter_id)
setattr(BaobabMixin, getter_id, method)
BaobabMixin.security.declareProtected(Permissions.View, getter_id)
value_getter_id = getter_id + 'Value'
method = BaobabValueGetter(value_getter_id, getter_id)
setattr(BaobabMixin, value_getter_id, method)
BaobabMixin.security.declareProtected(Permissions.View, value_getter_id)
for prop in ('uid', 'title', 'id'):
prop_getter_id = getter_id + convertToUpperCase(prop)
method = BaobabPropertyGetter(prop_getter_id, value_getter_id, prop)
setattr(BaobabMixin, prop_getter_id, method)
BaobabMixin.security.declareProtected(Permissions.View, prop_getter_id)
InitializeClass(BaobabMixin)
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL 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 proopgram 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.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Delivery import Delivery
from Products.ERP5Type.Document.DeliveryCell import DeliveryCell
from Products.ERP5.Document.Movement import Movement
from Products.ERP5.Document.AccountingTransaction import AccountingTransaction
from AccessControl.PermissionRole import PermissionRole
from Products.ERP5Type.Utils import convertToMixedCase, convertToUpperCase
from Products.ERP5Banking.BaobabMixin import BaobabMixin
class BankingOperation(BaobabMixin, AccountingTransaction):
# CMF Type Definition
meta_type = 'ERP5Banking Banking Operation'
portal_type = 'Banking Operation'
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.BankingOperation
, PropertySheet.ItemAggregation
, PropertySheet.Amount
)
### Dynamic patch
Delivery.getBaobabSourceUid = lambda x: x.getSourceUid()
Delivery.getBaobabSourceUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabDestinationUid = lambda x: x.getDestinationUid()
Delivery.getBaobabDestinationUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabSourceSectionUid = lambda x: x.getSourceSectionUid()
Delivery.getBaobabSourceSectionUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabDestinationSectionUid = lambda x: x.getDestinationSectionUid()
Delivery.getBaobabDestinationSectionUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabSourcePaymentUid = lambda x: x.getSourcePaymentUid()
Delivery.getBaobabSourcePaymentUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabDestinationPaymentUid = lambda x: x.getDestinationPaymentUid()
Delivery.getBaobabDestinationPaymentUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabSourceFunctionUid = lambda x: x.getSourceFunctionUid()
Delivery.getBaobabSourceFunctionUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabDestinationFunctionUid = lambda x: x.getDestinationFunctionUid()
Delivery.getBaobabDestinationFunctionUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabSourceProjectUid = lambda x: x.getSourceProjectUid()
Delivery.getBaobabSourceProjectUid__roles__ = PermissionRole(Permissions.View)
Delivery.getBaobabDestinationProjectUid = lambda x: x.getDestinationProjectUid()
Delivery.getBaobabDestinationProjectUid__roles__ = PermissionRole(Permissions.View)
### Overload Movement
Movement.getBaobabSourceUid = lambda x: x.getSourceUid()
Movement.getBaobabSourceUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabDestinationUid = lambda x: x.getDestinationUid()
Movement.getBaobabDestinationUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabSourceSectionUid = lambda x: x.getSourceSectionUid()
Movement.getBaobabSourceSectionUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabDestinationSectionUid = lambda x: x.getDestinationSectionUid()
Movement.getBaobabDestinationSectionUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabSourcePaymentUid = lambda x: x.getSourcePaymentUid()
Movement.getBaobabSourcePaymentUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabDestinationPaymentUid = lambda x: x.getDestinationPaymentUid()
Movement.getBaobabDestinationPaymentUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabSourceFunctionUid = lambda x: x.getSourceFunctionUid()
Movement.getBaobabSourceFunctionUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabDestinationFunctionUid = lambda x: x.getDestinationFunctionUid()
Movement.getBaobabDestinationFunctionUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabSourceProjectUid = lambda x: x.getSourceProjectUid()
Movement.getBaobabSourceProjectUid__roles__ = PermissionRole(Permissions.View)
Movement.getBaobabDestinationProjectUid = lambda x: x.getDestinationProjectUid()
Movement.getBaobabDestinationProjectUid__roles__ = PermissionRole(Permissions.View)
### Acquire Baobab source / destination uids from parent line
DeliveryCell.getBaobabSourceUid = lambda x: x.getSourceUid()
DeliveryCell.getBaobabSourceUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabDestinationUid = lambda x: x.getDestinationUid()
DeliveryCell.getBaobabDestinationUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabSourceSectionUid = lambda x: x.getSourceSectionUid()
DeliveryCell.getBaobabSourceSectionUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabDestinationSectionUid = lambda x: x.getDestinationSectionUid()
DeliveryCell.getBaobabDestinationSectionUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabSourcePaymentUid = lambda x: x.getSourcePaymentUid()
DeliveryCell.getBaobabSourcePaymentUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabDestinationPaymentUid = lambda x: x.getDestinationPaymentUid()
DeliveryCell.getBaobabDestinationPaymentUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabSourceFunctionUid = lambda x: x.getSourceFunctionUid()
DeliveryCell.getBaobabSourceFunctionUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabDestinationFunctionUid = lambda x: x.getDestinationFunctionUid()
DeliveryCell.getBaobabDestinationFunctionUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabSourceProjectUid = lambda x: x.getSourceProjectUid()
DeliveryCell.getBaobabSourceProjectUid__roles__ = PermissionRole(Permissions.View)
DeliveryCell.getBaobabDestinationProjectUid = lambda x: x.getDestinationProjectUid()
DeliveryCell.getBaobabDestinationProjectUid__roles__ = PermissionRole(Permissions.View)
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL 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.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.AccountingTransactionLine import AccountingTransactionLine
from Products.ERP5Banking.BaobabMixin import BaobabMixin
class BankingOperationLine(BaobabMixin, AccountingTransactionLine):
# CMF Type Definition
meta_type = 'ERP5Banking Banking Operation Line'
portal_type = 'Banking Operation Line'
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
)
security.declareProtected(Permissions.View, 'getSourceTotalAssetPrice')
def getSourceTotalAssetPrice(self):
"""Default to quantity."""
return self._baseGetSourceTotalAssetPrice() or abs(self.getQuantity())
security.declareProtected(Permissions.View, 'getDestinationTotalAssetPrice')
def getDestinationTotalAssetPrice(self):
"""Default to quantity."""
return self._baseGetDestinationTotalAssetPrice() or abs(self.getQuantity())
security.declareProtected(Permissions.View, 'getSourceTotalAssetPriceCurrencyReference')
def getSourceTotalAssetPriceCurrencyReference(self):
"""Return the reference of the price currency of the source payment."""
payment = self.getBaobabSourcePaymentValue()
if payment is not None:
currency = payment.getPriceCurrencyValue()
if currency is not None:
return currency.getReference()
return None
security.declareProtected(Permissions.View, 'getDestinationTotalAssetPriceCurrencyReference')
def getDestinationTotalAssetPriceCurrencyReference(self):
"""Return the reference of the price currency of the destination payment."""
payment = self.getBaobabDestinationPaymentValue()
if payment is not None:
currency = payment.getPriceCurrencyValue()
if currency is not None:
return currency.getReference()
return None
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL 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.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Container import Container
class CashContainer(Container):
"""
A Cash DeliveryLine object allows to implement lines
in Cash Deliveries (packing list, Check payment, Cash Movement, etc.).
It may include a price (for insurance, for customs, for invoices,
for orders).
"""
meta_type = 'ERP5Banking Cash Container'
portal_type = 'Cash Container'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
, PropertySheet.Container
, PropertySheet.CashContainer
, PropertySheet.Reference
)
##############################################################################
#
# Copyright (c) 2005 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.Resource import Resource
from zLOG import LOG
class CashCurrency(Resource):
"""
A Resource
"""
meta_type = 'ERP5Banking Cash Currency'
portal_type = 'Cash Currency'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative interfaces
__implements__ = ( Interface.Variated, )
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Price
, PropertySheet.Resource
, PropertySheet.Reference
, PropertySheet.FlowCapacity
, PropertySheet.VariationRange
, PropertySheet.CashCurrency
)
security.declareProtected(Permissions.View,'getTitle')
def getTitle(self,**kw):
"""
The title will depend on the Portal Type and the value, for example :
Piece de 500
"""
title = self.portal_types[self.getPortalType()].title
price = self.getBasePrice()
if price is None:
price = 'Not Defined'
else:
price = '%i' % int(price)
title = '%s de %s' % (title, price)
return title
security.declareProtected(Permissions.ModifyPortalContent, '_setVariationList')
def _setVariationList(self,value):
"""
We will create cells by the same time
"""
LOG('_setVariationList, value',0,value)
self._categorySetVariationList(value)
self.setVariationBaseCategoryList(('cash_status','emission_letter','variation'))
#all_variation_list = self.OrderLine_getMatrixItemList()
#emission_letter_list = [x for x in all_variation_list if x.startswith('emission_letter')]
emission_letter_list = [x[1] for x in self.portal_categories.emission_letter.getCategoryChildTitleItemList()[1:]]
self._categorySetEmissionLetterList(emission_letter_list)
#cash_status_list = [x for x in all_variation_list if x.startswith('cash_status')]
cash_status_list = [x[1] for x in self.portal_categories.cash_status.getCategoryChildTitleItemList()[1:]]
self._categorySetCashStatusList(cash_status_list)
security.declareProtected(Permissions.ModifyPortalContent, 'setVariationList')
def setVariationList(self,value):
"""
Call the private method
"""
self._setVariationList(value)
# Cell Related
security.declareProtected( Permissions.ModifyPortalContent, 'newCellContent' )
def newCellContent(self, id):
"""
This method can be overriden
"""
self.invokeFactory(type_name="Set Mapped Value",id=id)
return self.get(id)
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Kevin Deldycke <kevin_AT_nexedi_DOT_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.ERP5Type.Document.BankingOperation import BankingOperation
class CashDelivery(BankingOperation):
"""
"""
meta_type = 'ERP5Banking Cash Delivery'
portal_type = 'Cash Delivery'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative interfaces
__implements__ = ( Interface.Variated, )
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
)
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@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.DeliveryCell import DeliveryCell
from Products.ERP5Banking.BaobabMixin import BaobabMixin
class CashDeliveryCell(BaobabMixin, DeliveryCell):
"""
A Cash Delivery Cell object allows to implement cells
in Cash Deliveries (packing list, Check payment, Cash Movement, etc.).
It may include a price (for insurance, for customs, for invoices,
for orders).
"""
meta_type = 'ERP5Banking Cash Delivery Cell'
portal_type = 'Cash Delivery Cell'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative interfaces
__implements__ = ( Interface.Variated, )
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Arrow
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.ItemAggregation
)
security.declareProtected(Permissions.View, 'getBaobabSource')
def getBaobabSource(self, **kw):
"""
"""
return self.aq_parent.getBaobabSource(**kw)
security.declareProtected(Permissions.View, 'getBaobabDestination')
def getBaobabDestination(self, **kw):
"""
"""
return self.aq_parent.getBaobabDestination(**kw)
security.declareProtected(Permissions.View, 'getBaobabSourceSection')
def getBaobabSourceSection(self, **kw):
"""
"""
return self.aq_parent.getBaobabSourceSection(**kw)
security.declareProtected(Permissions.View, 'getBaobabDestinationSection')
def getBaobabDestinationSection(self, **kw):
"""
"""
return self.aq_parent.getBaobabDestinationSection(**kw)
security.declareProtected(Permissions.View, 'getBaobabSourcePayment')
def getBaobabSourcePayment(self, **kw):
"""
"""
return self.aq_parent.getBaobabSourcePayment(**kw)
security.declareProtected(Permissions.View, 'getBaobabDestinationPayment')
def getBaobabDestinationPayment(self, **kw):
"""
"""
return self.aq_parent.getBaobabDestinationPayment(**kw)
security.declareProtected(Permissions.View, 'getBaobabSourceFunction')
def getBaobabSourceFunction(self, **kw):
"""
"""
return self.aq_parent.getBaobabSourceFunction(**kw)
security.declareProtected(Permissions.View, 'getBaobabDestinationFunction')
def getBaobabDestinationFunction(self, **kw):
"""
"""
return self.aq_parent.getBaobabDestinationFunction(**kw)
security.declareProtected(Permissions.View, 'getBaobabSourceProject')
def getBaobabSourceProject(self, **kw):
"""
"""
return self.aq_parent.getBaobabSourceProject(**kw)
security.declareProtected(Permissions.View, 'getBaobabDestinationProject')
def getBaobabDestinationProject(self, **kw):
"""
"""
return self.aq_parent.getBaobabDestinationProject(**kw)
##############################################################################
#
# Copyright (c) 2005 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.DeliveryLine import DeliveryLine
from Products.ERP5Banking.BaobabMixin import BaobabMixin
in_portal_type_list = ('Cash Exchange Line In', 'Cash To Currency Sale Line In','Cash To Currency Purchase Line In', 'Cash Incident Line In')
out_portal_type_list = ('Cash Exchange Line Out', 'Cash To Currency Sale Line Out','Cash To Currency Purchase Line Out','Cash Incident Line Out')
class CashDeliveryLine(BaobabMixin, DeliveryLine):
"""
A Cash DeliveryLine object allows to implement lines
in Cash Deliveries (packing list, Check payment, Cash Movement, etc.).
It may include a price (for insurance, for customs, for invoices,
for orders).
"""
meta_type = 'ERP5Banking Cash Delivery Line'
portal_type = 'Cash Delivery Line'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative interfaces
__implements__ = ( Interface.Variated, )
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.VariationRange
, PropertySheet.ItemAggregation
, PropertySheet.CashDeliveryLine
)
security.declareProtected(Permissions.View, 'getBaobabSource')
def getBaobabSource(self):
"""
Returns a calculated source
"""
if self.portal_type in out_portal_type_list:
return self.portal_categories.resolveCategory(self.getSource()).unrestrictedTraverse('sortante').getRelativeUrl()
elif self.portal_type in in_portal_type_list:
return None
return self.getSource()
security.declareProtected(Permissions.View, 'getBaobabDestination')
def getBaobabDestination(self):
"""
Returns a calculated destination
"""
if self.portal_type in in_portal_type_list:
return self.portal_categories.resolveCategory(self.getSource()).unrestrictedTraverse('entrante').getUid()
elif self.portal_type in out_portal_type_list :
return None
return self.getDestination()
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# K. Toure <ktoure_AT_nexedi_DOT_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 BankingOperation:
"""
Person properties and categories
"""
_properties = (
# Subordination properties
{ 'id' : 'movement',
'storage_id' : 'movement',
'description' : 'The current amount',
'type' : 'content',
'portal_type' : ('Banking Operation Line'),
'acquired_property_id' : ('source_debit', 'source_credit'),
'mode' : 'w' },
)
_categories = ()
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL 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.
#
##############################################################################
class BaobabCategory:
"""
PropertySheetTemplate properties for all Baobab Categories
"""
_properties = (
{
'id' : 'codification',
'description' : 'category codified identifier',
'type' : 'string',
'mode' : 'w',
'default' : None,
'acquisition_base_category' : ('parent',),
'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 1,
'acquisition_accessor_id' : 'getCodification',
},
)
_categories = ('vault_type',)
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL 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.
#
##############################################################################
class CashContainer:
"""
VariationRange which allows to define possible
variations for a Resource, a Transformation, etc.
"""
_properties = (
{ 'id' : 'cash_number_range_start',
'description' : '',
'type' : 'string',
'mode' : 'w'
},
{ 'id' : 'cash_number_range_stop',
'description' : '',
'type' : 'string',
'mode' : 'w'
}
)
_categories = ( 'emission_letter','cash_status','variation')
##############################################################################
#
# Copyright (c) 2005 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.
#
##############################################################################
class CashCurrency:
"""
Properties which allow to define a BankNote or a Coin.
"""
_properties = ()
_categories = ( 'emission_letter'
, 'cash_status'
, 'variation'
)
##############################################################################
#
# Copyright (c) 2005 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.
#
##############################################################################
class CashDeliveryLine:
"""
VariationRange which allows to define possible
variations for a Resource, a Transformation, etc.
"""
_properties = (
)
_categories = ( 'emission_letter'
, 'cash_status'
)
ERP5Banking
ERP5Banking was automatically generated by ERP5 Class Tool.
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@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.
#
##############################################################################
"""
ERP5 Free Software ERP
"""
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Finish installation
def initialize( context ):
import Document
initializeProduct(context, this_module, globals(),
document_module = Document,
document_classes = document_classes,
object_classes = (),
portal_tools = (),
content_constructors = (),
content_classes = ())
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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