[Erp5-report] r31686 jerome - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 11 17:19:59 CET 2010


Author: jerome
Date: Mon Jan 11 17:19:57 2010
New Revision: 31686

URL: http://svn.erp5.org?rev=31686&view=rev
Log:
Constraints should not be based on user preferences.
We will check transaction validity for each organisation, even if not member of
our preferred group. A test contradicting this has been updated.


Modified:
    erp5/trunk/products/ERP5/Document/AccountingTransaction.py
    erp5/trunk/products/ERP5/tests/testAccounting.py

Modified: erp5/trunk/products/ERP5/Document/AccountingTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AccountingTransaction.py?rev=31686&r1=31685&r2=31686&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AccountingTransaction.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/AccountingTransaction.py [utf8] Mon Jan 11 17:19:57 2010
@@ -72,13 +72,7 @@
       """
       section = self.getSourceSectionValue()
       if section is not None:
-        preference_tool = getToolByName(self, 'portal_preferences')
-        preferred_section_category = preference_tool.\
-                getPreferredAccountingTransactionSectionCategory()
-        if preferred_section_category:
-          if section.getPortalType() == 'Person':
-            return False
-          return section.isMemberOf(preferred_section_category)
+        return section.getPortalType() != 'Person'
       return False
 
     security.declareProtected(Permissions.AccessContentsInformation,
@@ -89,13 +83,7 @@
       """
       section = self.getDestinationSectionValue()
       if section is not None:
-        preference_tool = getToolByName(self, 'portal_preferences')
-        preferred_section_category = preference_tool.\
-                getPreferredAccountingTransactionSectionCategory()
-        if preferred_section_category:
-          if section.getPortalType() == 'Person':
-            return False
-          return section.isMemberOf(preferred_section_category)
+        return section.getPortalType() != 'Person'
       return False
     
     security.declareProtected(Permissions.AccessContentsInformation,

Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=31686&r1=31685&r2=31686&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] Mon Jan 11 17:19:57 2010
@@ -3771,8 +3771,8 @@
                       destination_section_value=self.other_vendor)
       useBankAccount(accounting_transaction)
 
-      # payment node have to be set on both sides if both sides are member of
-      # the same group.
+      # payment node have to be set on both sides if both sides have accounting
+      # lines
       accounting_transaction.setSourcePaymentValue(source_payment_value)
       accounting_transaction.setDestinationPaymentValue(None)
       self.assertRaises(ValidationFailed,
@@ -3791,20 +3791,6 @@
         self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
         self.assertEquals(accounting_transaction.getSimulationState(), 'stopped')
       except ValidationFailed, err :
-        self.fail("Validation failed : %s" % err.msg)
-
-      # if we are not interested in the accounting for the third party, no need
-      # to have a destination_payment
-      accounting_transaction = self.createAccountingTransaction()
-      useBankAccount(accounting_transaction)
-      # only set payment for source
-      accounting_transaction.setSourcePaymentValue(source_payment_value)
-      accounting_transaction.setDestinationPaymentValue(None)
-      # then we should be able to validate.
-      try:
-        self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
-        self.assertEquals(accounting_transaction.getSimulationState(), 'stopped')
-      except ValidationFailed, err:
         self.fail("Validation failed : %s" % err.msg)
     
   def stepValidateRemoveEmptyLines(self, sequence, sequence_list=None, **kw):




More information about the Erp5-report mailing list