Commit 52fdb64d authored by Yoshinori Okuji's avatar Yoshinori Okuji

New methods, _setSource, setSource, _setDestination, setDestination

and _edit. These are for setting a mirror account.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@692 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7873bb0d
...@@ -33,6 +33,8 @@ from Products.CMFCore.WorkflowCore import WorkflowAction ...@@ -33,6 +33,8 @@ from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.DeliveryLine import DeliveryLine
from zLOG import LOG
class AccountingTransactionLine(DeliveryLine): class AccountingTransactionLine(DeliveryLine):
""" """
Accounting Transaction Lines allow to move some quantity of money from a source to a destination Accounting Transaction Lines allow to move some quantity of money from a source to a destination
...@@ -194,3 +196,41 @@ Une ligne tarifaire.""" ...@@ -194,3 +196,41 @@ Une ligne tarifaire."""
Temp Temp
""" """
return return
security.declarePrivate('_setSource')
def _setSource(self, value):
self._setCategoryMembership('source', value, base=0)
source = self.restrictedTraverse(value)
destination = self.getDestination()
mirror_list = source.getDestinationList()
#LOG('_setSource', 0, 'value = %s, mirror_list = %s, destination = %s' % (str(value), str(mirror_list), str(destination)))
if len(mirror_list) > 0 and destination not in mirror_list:
self._setCategoryMembership('destination', mirror_list[0], base=0)
security.declareProtected(Permissions.ModifyPortalContent, 'setSource')
def setSource(self, value):
self._setSource(value)
self.reindexObject()
security.declarePrivate('_setDestination')
def _setDestination(self, value):
self._setCategoryMembership('destination', value, base=0)
destination = self.restrictedTraverse(value)
source = self.getSource()
mirror_list = destination.getDestinationList()
#LOG('_setDestination', 0, 'value = %s, mirror_list = %s, source = %s' % (str(value), str(mirror_list), str(source)))
if len(mirror_list) > 0 and source not in mirror_list:
self._setCategoryMembership('source', mirror_list[0], base=0)
security.declareProtected(Permissions.ModifyPortalContent, 'setDestination')
def setDestination(self, value):
self._setDestination(value)
self.reindexObject()
security.declarePrivate('_edit')
def _edit(self, REQUEST = None, force_update = 0, **kw):
if kw.has_key('source'):
self._setSource(kw['source'])
if kw.has_key('destination'):
self._setDestination(kw['destination'])
DeliveryLine._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
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