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
b1668fda
Commit
b1668fda
authored
May 30, 2024
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: archive previous open sale order
parent
80f3817e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionChangeRequest_validateIfSubmitted.py
..._request/SubscriptionChangeRequest_validateIfSubmitted.py
+29
-5
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionChangeRequest_validateIfSubmitted.py
View file @
b1668fda
...
...
@@ -31,9 +31,9 @@ if open_order_movement is None:
identical_order_base_category_list
=
[
'specialise'
,
'destination'
,
'destination_section'
,
'destination_decisition'
,
#
'destination',
#
'destination_section',
#
'destination_decisition',
'destination_project'
,
'source'
,
'source_section'
,
...
...
@@ -43,13 +43,37 @@ identical_order_base_category_list = [
'resource'
,
'variation_category_list'
,
'quantity_unit'
,
'aggregate'
,
'quantity'
,
'price'
#
'price'
]
for
identical_order_base_category
in
identical_order_base_category_list
:
if
open_order_movement
.
getProperty
(
identical_order_base_category
)
!=
subscription_change_request
.
getProperty
(
identical_order_base_category
):
return
invalidate
(
subscription_change_request
,
'Unhandled requested changes on: %s'
%
identical_order_base_category
)
# Ensure the subscribed item is the same
subscribed_item
=
open_order_movement
.
getAggregateValue
(
portal_type
=
[
'Instance Tree'
,
'Compute Node'
,
'Project'
])
if
subscription_change_request
.
getAggregateUid
()
!=
subscribed_item
.
getUid
():
return
invalidate
(
subscription_change_request
,
'Unhandled requested changes on: aggregate'
)
# XXX Compensation
open_sale_order
.
OpenSaleOrder_archiveIfUnusedItem
(
check_unused_item
=
False
)
# Create new Open Sale Order
subscription_change_request
.
SubscriptionRequest_createOpenSaleOrder
()
# Change Subscripted Item user if needed
subscribed_item
=
open_order_movement
.
getAggregateValue
(
portal_type
=
[
'Instance Tree'
,
'Compute Node'
,
'Project'
])
if
subscribed_item
is
None
:
raise
NotImplementedError
(
'Unsupported subscribed item'
)
elif
subscribed_item
.
getPortalType
()
==
'Compute Node'
:
# No user is set on Compute Node
pass
elif
subscribed_item
.
getPortalType
()
==
'Instance Tree'
:
subscribed_item
.
edit
(
destination_section
=
subscription_change_request
.
getDestination
())
elif
subscribed_item
.
getPortalType
()
==
'Instance Tree'
:
subscribed_item
.
edit
(
destination
=
subscription_change_request
.
getDestination
())
else
:
raise
NotImplementedError
(
'Not implemented subscribed item'
)
return
invalidate
(
subscription_change_request
,
'Unknown requested changes'
)
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