Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
b0febdde
Commit
b0febdde
authored
Jun 16, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounting: in select fields display which organisation bank accounts belongs to
parent
cdb92e87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
5 deletions
+56
-5
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.py
...s/erp5_accounting/AccountModule_getBankAccountItemList.py
+22
-5
product/ERP5/tests/testAccounting.py
product/ERP5/tests/testAccounting.py
+34
-0
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.py
View file @
b0febdde
...
...
@@ -48,19 +48,36 @@ else:
item_list
=
[(
''
,
''
)]
for
bank
in
bank_account_list
:
bank
=
bank
.
getObject
()
# If we have bank accounts from more than one organisation, include
# the organisation as hierarchy to show which organisation the bank
# account belongs to.
include_organisation_hierarchy
=
len
(
set
(
[
'/'
.
join
(
b
.
path
.
split
(
'/'
)[:
-
1
])
for
b
in
bank_account_list
]))
>
1
previous_organisation
=
None
# sort bank accounts in a way that bank accounts from the same
# organisation are consecutive
for
brain
in
sorted
(
bank_account_list
,
key
=
lambda
b
:
b
.
path
):
bank
=
brain
.
getObject
()
if
include_organisation_hierarchy
:
organisation
=
bank
.
getParentValue
()
if
organisation
!=
previous_organisation
:
previous_organisation
=
organisation
# include non-selectable element to show hierarchy
item_list
.
append
((
organisation
.
getTranslatedTitle
(),
None
))
if
bank
.
getReference
()
and
bank
.
getTitle
()
\
and
bank
.
getReference
()
!=
bank
.
getTitle
():
item_list
.
append
((
'%s - %s'
%
(
bank
.
getReference
(),
bank
.
getTitle
()
or
bank
.
getTitle
()
or
bank
.
getSourceFreeText
()
or
bank
.
getSourceTitle
()),
bank
.
getRelativeUrl
()))
else
:
item_list
.
append
((
bank
.
getReference
()
or
bank
.
getTitle
()
or
bank
.
getTitle
()
or
bank
.
getSourceFreeText
()
or
bank
.
getSourceTitle
(),
bank
.
getRelativeUrl
()
))
...
...
product/ERP5/tests/testAccounting.py
View file @
b0febdde
...
...
@@ -4354,6 +4354,17 @@ class TestTransactions(AccountingTestCase):
(
'from section'
,
bank_account
.
getRelativeUrl
()),
source_transaction
.
AccountingTransaction_getSourcePaymentItemList
())
# We include non selectable elements in the drop down to show which to which organisation
# the bank account belongs to.
self
.
assertEqual
(
[(
''
,
''
),
(
self
.
main_section
.
getTitle
(),
None
),
(
'from main section'
,
parent_bank_account
.
getRelativeUrl
()),
(
self
.
section
.
getTitle
(),
None
),
(
'from section'
,
bank_account
.
getRelativeUrl
()),
],
source_transaction
.
AccountingTransaction_getSourcePaymentItemList
())
destination_transaction
=
self
.
_makeOne
(
portal_type
=
'Payment Transaction'
,
destination_section_value
=
self
.
section
,
...
...
@@ -4369,6 +4380,29 @@ class TestTransactions(AccountingTestCase):
(
'from section'
,
bank_account
.
getRelativeUrl
()),
destination_transaction
.
AccountingTransaction_getDestinationPaymentItemList
())
main_section_transaction
=
self
.
_makeOne
(
portal_type
=
'Payment Transaction'
,
source_section_value
=
self
.
main_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
()),
main_section_transaction
.
AccountingTransaction_getSourcePaymentItemList
())
self
.
assertNotIn
(
(
'from section'
,
bank_account
.
getRelativeUrl
()),
main_section_transaction
.
AccountingTransaction_getSourcePaymentItemList
())
# We don't have this non selectable element when all bank accounts are from
# the same organisation
self
.
assertEqual
(
[(
''
,
''
),
(
'from main section'
,
parent_bank_account
.
getRelativeUrl
()),
],
main_section_transaction
.
AccountingTransaction_getSourcePaymentItemList
())
def
test_AccountingTransaction_getSourcePaymentItemList_parent_section_with_accounting_period
(
self
):
# AccountingTransaction_getSourcePaymentItemList and AccountingTransaction_getDestinationPaymentItemList
# allows to select bank accounts from parent groups of source section, but not if
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment