Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
416b3627
Commit
416b3627
authored
Oct 18, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: test paying invoices
parent
f84f49bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
..._components/test.erp5.testSlapOSERP5AccountingScenario.py
+55
-0
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
View file @
416b3627
...
...
@@ -138,7 +138,11 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# Discount and first subscription
self
.
assertEqual
(
first_invoice
.
getTotalPrice
(),
24.384
)
# Ensure no unexpected object has been created
# 1 accounting transaction
# 1 open order
# 2 assignment
# 2 simulation movements
# 1 sale packing list
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
10
)
...
...
@@ -157,11 +161,62 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertEquals
(
amount_list
[
0
].
total_price
,
125.184
)
self
.
assertEqual
(
first_invoice
.
getSimulationState
(),
"stopped"
)
# Ensure no unexpected object has been created
# 4 accounting transactions
# 1 open order
# 2 assignment
# 8 simulation movements
# 4 sale packing list
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
22
)
# Try to pay previous period
with
PinnedDateTime
(
self
,
DateTime
(
'2021/07/06'
)):
payment_transaction
=
owner_person
.
Entity_createPaymentTransaction
(
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
False
,
at_date
=
DateTime
(
'2021/05/06'
),
section_uid
=
first_invoice
.
getSourceSectionUid
(),
resource_uid
=
first_invoice
.
getPriceCurrencyUid
(),
ledger_uid
=
first_invoice
.
getLedgerUid
(),
group_by_node
=
False
)
)
self
.
assertEquals
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
74.78399999999999
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEquals
(
len
(
amount_list
),
1
)
self
.
assertEquals
(
amount_list
[
0
].
total_price
,
100.8
)
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
False
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
False
)
self
.
assertEquals
(
len
(
amount_list
),
1
)
self
.
assertEquals
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertTrue
(
first_invoice
.
SaleInvoiceTransaction_isLettered
())
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
payment_transaction
=
owner_person
.
Entity_createPaymentTransaction
(
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
False
,
section_uid
=
first_invoice
.
getSourceSectionUid
(),
resource_uid
=
first_invoice
.
getPriceCurrencyUid
(),
ledger_uid
=
first_invoice
.
getLedgerUid
(),
group_by_node
=
False
)
)
self
.
assertEquals
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
50.4
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEquals
(
len
(
amount_list
),
1
)
self
.
assertEquals
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
False
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
False
)
self
.
assertEquals
(
len
(
amount_list
),
0
)
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
with
PinnedDateTime
(
self
,
DateTime
(
'2021/07/06'
)):
self
.
checkERP5StateBeforeExit
()
\ No newline at end of file
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