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):
"""
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 @@ class AccountingTransaction(Delivery):
"""
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,
......
......@@ -3771,8 +3771,8 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
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,
......@@ -3792,20 +3792,6 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
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):
"""Check validating a transaction remove empty lines. """
......
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