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
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
slapos.core
Commits
c1b7e30f
Commit
c1b7e30f
authored
Oct 02, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: use Subscription Change Request to move a Subscription to b2b
parent
129d3d5d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
46 deletions
+27
-46
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
...t.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
+6
-4
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Organisation_claimSlaposSubscriptionRequest.py
...apos_panel/Organisation_claimSlaposSubscriptionRequest.py
+21
-5
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
...iption_request/SubscriptionRequest_validateIfSubmitted.py
+0
-37
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
View file @
c1b7e30f
...
...
@@ -178,8 +178,8 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# 1 software instance
# 1 software product
# 1 subscription change request
#
2
subscription request
self
.
assertRelatedObjectCount
(
project
,
3
2
)
#
3
subscription request
self
.
assertRelatedObjectCount
(
project
,
3
3
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
...
...
@@ -280,8 +280,9 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# Ensure no unexpected object has been created
# 2 assignment
# 2 sale trade condition
# 1 subscription change request
# 2 subscription request
self
.
assertRelatedObjectCount
(
project
,
6
)
self
.
assertRelatedObjectCount
(
project
,
7
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
...
...
@@ -404,8 +405,9 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# 2 sale trade condition
# 2 sale supply*
# 3 sale trade conditions
# 1 subscription change request
# 3 subscription request
self
.
assertRelatedObjectCount
(
project
,
1
2
)
self
.
assertRelatedObjectCount
(
project
,
1
3
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
\ No newline at end of file
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Organisation_claimSlaposSubscriptionRequest.py
View file @
c1b7e30f
...
...
@@ -7,6 +7,10 @@ if REQUEST is not None:
raise
Unauthorized
batch
=
(
dialog_id
is
None
)
if
activate_kw
is
None
:
activate_kw
=
{}
tag
=
activate_kw
.
get
(
'tag'
,
script
.
id
)
activate_kw
[
'tag'
]
=
tag
# Search for the matching item
sql_subscription_request_list
=
portal
.
portal_catalog
(
...
...
@@ -51,11 +55,11 @@ subscription_change_request = subscription_request.getResourceValue().Resource_c
subscription_request
.
getVariationCategoryList
(),
project
,
currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
temp_object
=
True
,
item_value
=
item
,
causality_value
=
subscription_request
.
getCausalityValue
()
causality_value
=
subscription_request
.
getCausalityValue
(),
temp_object
=
True
,
portal_type
=
'Subscription Change Request'
)
current_trade_condition
=
subscription_change_request
.
getSpecialiseValue
()
if
(
current_trade_condition
.
getDestination
()
is
None
):
...
...
@@ -71,8 +75,10 @@ if (current_trade_condition.getDestination() is None):
source_project
=
current_trade_condition
.
getSourceProject
(),
price_currency
=
current_trade_condition
.
getPriceCurrency
(),
trade_condition_type
=
current_trade_condition
.
getTradeConditionType
(),
activate_kw
=
activate_kw
)
new_sale_trade_condition
.
validate
()
context
.
activate
(
activity
=
'SQLQueue'
,
after_tag
=
tag
).
Organisation_claimSlaposSubscriptionRequest
(
reference
,
None
,
activate_kw
)
keep_items
=
{
'portal_status_message'
:
Base_translateString
(
'Creating a dedicated Trade Condition for the customer'
)
}
...
...
@@ -81,11 +87,21 @@ if (current_trade_condition.getDestination() is None):
return
new_sale_trade_condition
.
Base_redirect
(
keep_items
=
keep_items
)
else
:
subscription_change_request
=
subscription_request
.
getResourceValue
().
Resource_createSubscriptionRequest
(
subscription_request
.
getDestinationValue
(),
# [software_type, software_release],
subscription_request
.
getVariationCategoryList
(),
project
,
currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
item_value
=
item
,
causality_value
=
subscription_request
,
portal_type
=
'Subscription Change Request'
)
keep_items
=
{
'your_reference'
:
reference
,
'portal_status_level'
:
'error'
,
'portal_status_message'
:
Base_translateString
(
'This customer already has a dedicated Trade Condition'
)
}
if
batch
:
r
aise
ValueError
(
keep_items
[
'portal_status_message'
])
return
current_trade_condition
.
Base_redirect
(
keep_items
=
keep_items
)
r
eturn
subscription_change_request
return
subscription_change_request
.
Base_redirect
(
keep_items
=
keep_items
)
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
View file @
c1b7e30f
...
...
@@ -53,43 +53,6 @@ if 0 < total_price:
if
balance
<
total_price
:
markHistory
(
subscription_request
,
'Your user does not have enough deposit.'
)
# Check if a new trade condition has been created to
# replace the existing one
# (customer's service paid by an organisation)
if
item
.
getPortalType
()
==
'Project'
:
project
=
item
else
:
project
=
subscription_request
.
getSourceProjectValue
()
try
:
subscription_change_request
=
subscription_request
.
getResourceValue
().
Resource_createSubscriptionRequest
(
subscription_request
.
getDestinationValue
(),
# [software_type, software_release],
subscription_request
.
getVariationCategoryList
(),
project
,
currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
temp_object
=
True
,
item_value
=
item
,
causality_value
=
subscription_request
.
getCausalityValue
()
)
except
AssertionError
:
pass
else
:
if
subscription_change_request
.
getSpecialise
()
!=
subscription_request
.
getSpecialise
():
# We have a matching Trade Condition.
# We can recreate the Subscription Request
subscription_change_request
=
subscription_request
.
getResourceValue
().
Resource_createSubscriptionRequest
(
subscription_request
.
getDestinationValue
(),
# [software_type, software_release],
subscription_request
.
getVariationCategoryList
(),
project
,
currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
item_value
=
item
,
causality_value
=
subscription_request
.
getCausalityValue
()
)
subscription_request
.
cancel
(
comment
=
'Replaced by %s'
%
subscription_change_request
.
getReference
())
return
if
subscription_request
.
checkConsistency
():
...
...
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