From c208a63858a701c7164b201466d55dade34ed0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Thu, 11 May 2006 09:49:52 +0000 Subject: [PATCH] add support for getBaobabSource/DestinationVariationText and remove some hardcoded stuff git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7186 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Banking/BaobabMixin.py | 5 +-- .../ERP5Banking/Document/CashDeliveryCell.py | 18 +++++++++++ .../ERP5Banking/Document/CashDeliveryLine.py | 31 ++++++++++++------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/product/ERP5Banking/BaobabMixin.py b/product/ERP5Banking/BaobabMixin.py index 4bfdea0be9..6a29343dfc 100755 --- a/product/ERP5Banking/BaobabMixin.py +++ b/product/ERP5Banking/BaobabMixin.py @@ -112,7 +112,8 @@ for category in ('source', 'destination', 'source_section', 'destination_section', 'source_payment', 'destination_payment', 'source_function', 'destination_function', - 'source_project', 'destination_project'): + 'source_project', 'destination_project', + 'source_variation_text', 'destination_variation_text',): getter_id = 'getBaobab%s' % (convertToUpperCase(category)) original_getter_id = 'get%s' % (convertToUpperCase(category)) method = BaobabGetter(getter_id, original_getter_id) @@ -130,4 +131,4 @@ for category in ('source', 'destination', setattr(BaobabMixin, prop_getter_id, method) BaobabMixin.security.declareProtected(Permissions.View, prop_getter_id) -InitializeClass(BaobabMixin) \ No newline at end of file +InitializeClass(BaobabMixin) diff --git a/product/ERP5Banking/Document/CashDeliveryCell.py b/product/ERP5Banking/Document/CashDeliveryCell.py index af717170be..6187f6f758 100755 --- a/product/ERP5Banking/Document/CashDeliveryCell.py +++ b/product/ERP5Banking/Document/CashDeliveryCell.py @@ -130,3 +130,21 @@ class CashDeliveryCell(BaobabMixin, DeliveryCell): """ """ return self.aq_parent.getBaobabDestinationProject(**kw) + + security.declareProtected(Permissions.View, 'getBaobabSourceVariationText') + def getBaobabSourceVariationText(self, **kw): + """ + """ + script = self._getTypeBasedMethod('getBaobabSourceVariationText') + if script is not None: + return script(self) + return self.aq_parent.getBaobabSourceVariationText(**kw) + + security.declareProtected(Permissions.View, 'getBaobabDestinationVariationText') + def getBaobabDestinationVariationText(self, **kw): + """ + """ + script = self._getTypeBasedMethod('getBaobabDestinationVariationText') + if script is not None: + return script(self) + return self.aq_parent.getBaobabDestinationVariationText(**kw) diff --git a/product/ERP5Banking/Document/CashDeliveryLine.py b/product/ERP5Banking/Document/CashDeliveryLine.py index 19bb4f2a68..89d2c0678a 100755 --- a/product/ERP5Banking/Document/CashDeliveryLine.py +++ b/product/ERP5Banking/Document/CashDeliveryLine.py @@ -31,10 +31,6 @@ 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 @@ -79,10 +75,6 @@ class CashDeliveryLine(BaobabMixin, DeliveryLine): script = self._getTypeBasedMethod('getBaobabSource') if script is not None: return script(self) - 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') @@ -93,9 +85,24 @@ class CashDeliveryLine(BaobabMixin, DeliveryLine): script = self._getTypeBasedMethod('getBaobabDestination') if script is not None: return script(self) - 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() + security.declareProtected(Permissions.View, 'getBaobabSourceVariationText') + def getBaobabSourceVariationText(self): + """ + Returns a calculated source variation text + """ + script = self._getTypeBasedMethod('getBaobabSourceVariationText') + if script is not None: + return script(self) + return self.getVariationText() + + security.declareProtected(Permissions.View, 'getBaobabDestinationVariationText') + def getBaobabDestinationVariationText(self): + """ + Returns a calculated destination variation text + """ + script = self._getTypeBasedMethod('getBaobabDestinationVariationText') + if script is not None: + return script(self) + return self.getVariationText() -- 2.30.9