Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Titouan Soulard
erp5
Commits
c61340e1
Commit
c61340e1
authored
Sep 17, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
bank_reconciliation: properly support payment at previous bank statement date
See merge request
nexedi/erp5!1264
parents
3453958d
9da2d2d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
14 deletions
+53
-14
bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_checkPreviousBalance.py
...reconciliation/BankReconciliation_checkPreviousBalance.py
+1
-3
bt5/erp5_bank_reconciliation/TestTemplateItem/portal_components/test.erp5.testBankReconciliation.py
...tem/portal_components/test.erp5.testBankReconciliation.py
+28
-8
bt5/erp5_bank_reconciliation/TestTemplateItem/portal_components/test.erp5.testBankReconciliation.xml
...em/portal_components/test.erp5.testBankReconciliation.xml
+24
-3
No files found.
bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_checkPreviousBalance.py
View file @
c61340e1
...
...
@@ -6,9 +6,7 @@ if context.getSourcePayment():
precision
=
context
.
getQuantityPrecisionFromResource
(
context
.
getSourcePaymentValue
().
getPriceCurrency
())
at_date
=
context
.
getStartDate
()
assert
at_date
return
round
(
context
.
getQuantityRangeMin
(),
precision
)
\
==
round
(
context
.
BankReconciliation_getReconciledAccountBalance
(
at_date
=
at_date
),
precision
)
at_date
=
context
.
getStartDate
().
latestTime
()
),
precision
)
bt5/erp5_bank_reconciliation/TestTemplateItem/portal_components/test.erp5.testBankReconciliation.py
View file @
c61340e1
...
...
@@ -333,7 +333,7 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
stop_date
=
DateTime
(
2014
,
1
,
31
))
previous_bank_reconciliation
.
open
()
self
.
_makeOne
(
reconcilied_payment
=
self
.
_makeOne
(
portal_type
=
'Payment Transaction'
,
simulation_state
=
'delivered'
,
source_payment_value
=
self
.
bank_account
,
...
...
@@ -368,30 +368,50 @@ class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
# reconciled balance must match
bank_reconciliation
.
setQuantityRangeMax
(
10
)
self
.
assertEqual
(
1
,
len
(
bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
bank_reconciliation
.
checkConsistency
()],
[
"Bank statement balance does not match reconciled balance"
])
bank_reconciliation
.
setQuantityRangeMax
(
100
)
self
.
assertEqual
(
0
,
len
(
bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
bank_reconciliation
.
checkConsistency
()],
[])
self
.
assertEqual
(
0
,
len
(
previous_bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
previous_bank_reconciliation
.
checkConsistency
()],
[])
previous_bank_reconciliation
.
setQuantityRangeMax
(
10
)
self
.
assertEqual
(
1
,
len
(
previous_bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
previous_bank_reconciliation
.
checkConsistency
()],
[
'Bank statement balance does not match reconciled balance'
])
previous_bank_reconciliation
.
setQuantityRangeMax
(
100
)
# Previous reconciled balance must match as well
bank_reconciliation
.
setStartDate
(
DateTime
(
2014
,
1
,
31
))
bank_reconciliation
.
setQuantityRangeMin
(
10
)
self
.
assertEqual
(
1
,
len
(
bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
bank_reconciliation
.
checkConsistency
()],
[
'Previous bank statement balance does not match reconciled balance at previous bank statement date'
])
# edge case, payments on the day of previous statement date, but after 00:00 are reconciled at the
# previous bank statement date.
reconcilied_payment
.
setStartDate
(
DateTime
(
2014
,
1
,
31
,
12
,
34
))
bank_reconciliation
.
setQuantityRangeMin
(
100
)
self
.
tic
()
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
bank_reconciliation
.
checkConsistency
()],
[])
bank_reconciliation
.
setQuantityRangeMin
(
10
)
# These constraints are only verified when we go from open to close state.
# (that is why the bank reconciliation have been openned for the
# assertions above)
with
self
.
assertRaises
(
ValidationFailed
):
with
self
.
assertRaisesRegexp
(
ValidationFailed
,
"Previous bank statement balance does not match reconciled balance at previous bank statement date"
):
self
.
portal
.
portal_workflow
.
doActionFor
(
bank_reconciliation
,
'close_action'
)
bank_reconciliation
.
setQuantityRangeMin
(
100
)
self
.
assertEqual
(
0
,
len
(
bank_reconciliation
.
checkConsistency
()))
self
.
assertEqual
(
[
str
(
m
.
getTranslatedMessage
())
for
m
in
bank_reconciliation
.
checkConsistency
()],
[])
self
.
portal
.
portal_workflow
.
doActionFor
(
bank_reconciliation
,
'close_action'
)
...
...
bt5/erp5_bank_reconciliation/TestTemplateItem/portal_components/test.erp5.testBankReconciliation.xml
View file @
c61340e1
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testBankReconciliation
</string>
</value>
...
...
@@ -53,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -72,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
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