Commit 63dc8c7b authored by Jérome Perrin's avatar Jérome Perrin

Fix for "section bank account" select being empty on reports dialogs and payment transaction

backport nexedi/erp5!295

/reviewed-on https://lab.nexedi.com/nexedi/erp5-capago/merge_requests/7
parents 8cfca629 29418843
......@@ -31,7 +31,7 @@ if organisation:
while group_value.getPortalType() != 'Base Category':
uid_list.append(group_value.getUid())
group_value = group_value.getParentValue()
search_kw['parent_strict_group_uid'] = uid_list
search_kw['strict_parent_group_uid'] = uid_list
search_kw['parent_portal_type'] = 'Organisation'
bank_account_list = portal.portal_catalog(**search_kw)
......
......@@ -4276,6 +4276,88 @@ class TestTransactions(AccountingTestCase):
('getSourceSectionTitle', 'Third Party'),
at.AccountingTransaction_getListBoxColumnList(source=False))
def test_AccountingTransaction_getSourcePaymentItemList(self):
# AccountingTransaction_getSourcePaymentItemList allows to select bank accounts
# from section
bank_account = self.section.newContent(
portal_type='Bank Account',
reference='BA-1'
)
bank_account.validate()
self.tic()
at = self._makeOne(
portal_type='Payment Transaction',
source_section_value=self.section,
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)))
self.assertIn(
('BA-1', bank_account.getRelativeUrl()),
at.AccountingTransaction_getSourcePaymentItemList())
def test_AccountingTransaction_getDestinationPaymentItemList(self):
# AccountingTransaction_getDestinationPaymentItemList allows to select bank accounts
# from destination section
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.section,
source_section_value=self.organisation_module.client_1,
lines=(dict(destination_value=self.account_module.goods_purchase,
destination_debit=500),
dict(destination_value=self.account_module.receivable,
destination_credit=500)))
self.assertIn(
('BA-1', bank_account.getRelativeUrl()),
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
parent_bank_account = self.main_section.newContent(
portal_type='Bank Account',
reference='from main section'
)
parent_bank_account.validate()
main_section_accounting_period = self.main_section.newContent(
portal_type='Accounting Period',
)
main_section_accounting_period.start()
self.tic()
source_transaction = self._makeOne(
portal_type='Payment Transaction',
source_section_value=self.section,
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)))
self.assertIn(
('from main section', parent_bank_account.getRelativeUrl()),
source_transaction.AccountingTransaction_getSourcePaymentItemList())
destination_transaction = self._makeOne(
portal_type='Payment Transaction',
destination_section_value=self.section,
source_section_value=self.organisation_module.client_1,
lines=(dict(destination_value=self.account_module.goods_purchase,
destination_debit=500),
dict(destination_value=self.account_module.receivable,
destination_credit=500)))
self.assertIn(
('from main section', parent_bank_account.getRelativeUrl()),
destination_transaction.AccountingTransaction_getDestinationPaymentItemList())
class TestAccountingWithSequences(ERP5TypeTestCase):
"""The first test for Accounting
......
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