Commit e8fb3769 authored by Jérome Perrin's avatar Jérome Perrin

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.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31686 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent df40af07
...@@ -72,13 +72,7 @@ class AccountingTransaction(Delivery): ...@@ -72,13 +72,7 @@ class AccountingTransaction(Delivery):
""" """
section = self.getSourceSectionValue() section = self.getSourceSectionValue()
if section is not None: if section is not None:
preference_tool = getToolByName(self, 'portal_preferences') return section.getPortalType() != 'Person'
preferred_section_category = preference_tool.\
getPreferredAccountingTransactionSectionCategory()
if preferred_section_category:
if section.getPortalType() == 'Person':
return False
return section.isMemberOf(preferred_section_category)
return False return False
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -89,13 +83,7 @@ class AccountingTransaction(Delivery): ...@@ -89,13 +83,7 @@ class AccountingTransaction(Delivery):
""" """
section = self.getDestinationSectionValue() section = self.getDestinationSectionValue()
if section is not None: if section is not None:
preference_tool = getToolByName(self, 'portal_preferences') return section.getPortalType() != 'Person'
preferred_section_category = preference_tool.\
getPreferredAccountingTransactionSectionCategory()
if preferred_section_category:
if section.getPortalType() == 'Person':
return False
return section.isMemberOf(preferred_section_category)
return False return False
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
...@@ -3771,8 +3771,8 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -3771,8 +3771,8 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
destination_section_value=self.other_vendor) destination_section_value=self.other_vendor)
useBankAccount(accounting_transaction) useBankAccount(accounting_transaction)
# payment node have to be set on both sides if both sides are member of # payment node have to be set on both sides if both sides have accounting
# the same group. # lines
accounting_transaction.setSourcePaymentValue(source_payment_value) accounting_transaction.setSourcePaymentValue(source_payment_value)
accounting_transaction.setDestinationPaymentValue(None) accounting_transaction.setDestinationPaymentValue(None)
self.assertRaises(ValidationFailed, self.assertRaises(ValidationFailed,
...@@ -3793,20 +3793,6 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -3793,20 +3793,6 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
except ValidationFailed, err : except ValidationFailed, err :
self.fail("Validation failed : %s" % err.msg) 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): def stepValidateRemoveEmptyLines(self, sequence, sequence_list=None, **kw):
"""Check validating a transaction remove empty lines. """ """Check validating a transaction remove empty lines. """
accounting_transaction = sequence.get('transaction') accounting_transaction = sequence.get('transaction')
......
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