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
2b227530
Commit
2b227530
authored
Feb 28, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: test InstanceTree_requestUpdateOpenSaleOrder
parent
24eb38eb
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
423 additions
and
551 deletions
+423
-551
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
...pos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
+10
-10
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
...tal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
+1
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
.../portal_components/test.erp5.testSlapOSAccountingAlarm.py
+1
-540
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+411
-0
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/InstanceTree_requestUpdateOpenSaleOrder.py
View file @
2b227530
...
...
@@ -136,24 +136,24 @@ if instance_tree.getCausalityState() == 'diverged':
if
person
is
not
None
:
# Search an existing related open order
open_order_
line
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Open Sale Order
Line
'
,
default_aggregate
_uid
=
instance_tree
.
getUid
())
open_order_
cell
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Open Sale Order
Cell
'
,
aggregate_
_uid
=
instance_tree
.
getUid
())
is_open_order_creation_needed
=
False
# Simply check that it has never been simulated
if
instance_tree
.
getSlapState
()
==
'destroy_requested'
:
# Line should be deleted
if
(
open_order_
line
is
not
None
)
and
(
open_order_line
.
getValidationState
()
==
"invalidated"
):
instance_tree
.
converge
(
comment
=
"Last open order: %s"
%
open_order_
line
.
getRelativeUrl
())
elif
open_order_
line
is
None
:
if
(
open_order_
cell
is
not
None
)
and
(
open_order_cell
.
getParentValue
()
.
getValidationState
()
==
"invalidated"
):
instance_tree
.
converge
(
comment
=
"Last open order: %s"
%
open_order_
cell
.
getRelativeUrl
())
elif
open_order_
cell
is
None
:
# User has no Open Sale Order (likely).
# No need to charge, as it was never allocated
is_open_order_creation_needed
=
False
instance_tree
.
converge
(
comment
=
"No open order needed as it was never allocated"
)
elif
open_order_
line
is
None
:
elif
open_order_
cell
is
None
:
# Let's add
is_open_order_creation_needed
=
True
...
...
@@ -205,8 +205,8 @@ if instance_tree.getCausalityState() == 'diverged':
price
=
order_cell
.
getPrice
()
)
if
open_order_
line
is
not
None
:
if
open_order_
cell
is
not
None
:
open_order_line
=
open_order_cell
.
getParentValue
()
assert
open_order_line
.
getResource
().
startswith
(
'software_product'
)
assert
open_order_line
.
getQuantityUnit
()
==
'time/month'
,
open_order_line
.
getQuantityUnit
()
assert
open_order_line
.
getBaseContribution
()
==
'base_amount/invoicing/discounted'
...
...
@@ -215,7 +215,7 @@ if instance_tree.getCausalityState() == 'diverged':
#assert open_order_line.getPrice() == 1, open_order_line.getPrice()
assert
open_order_cell
.
getQuantity
()
==
1
open_
sale_order
.
OpenSaleOrder_updatePeriod
()
open_
order_line
.
getParentValue
()
.
OpenSaleOrder_updatePeriod
()
# Person_storeOpenSaleOrderJournal should fix all divergent Instance Tree in one run
assert
instance_tree
.
getCausalityState
()
==
'solved'
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
View file @
2b227530
...
...
@@ -95,7 +95,7 @@ if open_sale_order.getValidationState() == 'validated':
assert
instance_tree
.
getCausalityState
()
==
'diverged'
instance_tree
.
converge
(
comment
=
"Last open order: %s"
%
open_order_line
.
getRelativeUrl
())
open_sale_order
.
archiv
e
()
open_sale_order
.
invalidat
e
()
storeWorkflowComment
(
open_sale_order
,
"Instance Tree destroyed: %s"
%
instance_tree
.
getRelativeUrl
())
elif
(
instance_tree
.
getCausalityState
()
==
'diverged'
):
instance_tree
.
converge
(
comment
=
"Nothing to do on open order."
)
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
View file @
2b227530
This diff is collapsed.
Click to expand it.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
2b227530
This diff is collapsed.
Click to expand it.
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