Commit 05d69dd7 authored by Jérome Perrin's avatar Jérome Perrin

accounting: fix bank accounts on profile tab when no entity selected

On a transaction without section / mirror section, on the profile tab
all accouts where displayed
parent 6050da0d
return context.AccountModule_getBankAccountItemList(
organisation=context.getDestinationSection(),
section = context.getDestinationSection()
if section:
return context.AccountModule_getBankAccountItemList(
organisation=section,
base_category='destination_payment')
return [('', '')]
return context.AccountModule_getBankAccountItemList(
organisation=context.getSourceSection(),
section = context.getSourceSection()
if section:
return context.AccountModule_getBankAccountItemList(
organisation=section,
base_category='source_payment')
return [('', '')]
......@@ -4644,6 +4644,28 @@ class TestTransactions(AccountingTestCase):
('BA-1', bank_account.getRelativeUrl()),
at.AccountingTransaction_getDestinationPaymentItemList())
def test_AccountingTransaction_getSourcePaymentItemList_no_section(self):
bank_account = self.section.newContent(
portal_type='Bank Account',
reference='BA-1'
)
bank_account.validate()
self.tic()
at = self._makeOne(
portal_type='Payment Transaction',
destination_section_value=self.organisation_module.client_1,
lines=(dict(source_value=self.account_module.goods_purchase,
source_debit=500),
dict(source_value=self.account_module.receivable,
source_credit=500)))
at.setSourceSectionValue(None)
at.setDestinationSectionValue(None)
self.assertEqual(
at.AccountingTransaction_getSourcePaymentItemList(), [('', '')])
self.assertEqual(
at.AccountingTransaction_getDestinationPaymentItemList(), [('', '')])
def test_AccountingTransaction_getSourcePaymentItemList_parent_section(self):
# AccountingTransaction_getSourcePaymentItemList and AccountingTransaction_getDestinationPaymentItemList
# allows to select bank accounts from parent groups of source section
......
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