Commit 628a30a7 authored by Jérome Perrin's avatar Jérome Perrin

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

Section bank account item list script was using `parent_strict_group_uid` related key but in 772033ed we removed
`parent_strict_group_uid` related key and added support to generate
`strict_parent_group_uid` related key.

 In that case, *Section Bank Account* field on payment transaction was empty  
![Screenshot_2017-06-16_at_18.54.33](/uploads/4f439bf14fb8b4d54df80031d281ce7a/Screenshot_2017-06-16_at_18.54.33.png) 

The 
`TypeError: Unknown columns ['parent_strict_group_uid']`
was only in the log files, because we are still ignoring errors in TALES.

I'm adding tests to cover this script, it's logic should have been tested anyway.

/reviewed-on nexedi/erp5!295
parents c09bea2a abd5adde
......@@ -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