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
c61c99b9
Commit
c61c99b9
authored
Apr 12, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: use different trade condition for instance and node
parent
a4c3bbb5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
11 deletions
+38
-11
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
...os_subscription_request/Item_createSubscriptionRequest.py
+2
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Resource_createSubscriptionRequest.py
...ubscription_request/Resource_createSubscriptionRequest.py
+17
-7
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Resource_createSubscriptionRequest.xml
...bscription_request/Resource_createSubscriptionRequest.xml
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
...iption_request/SubscriptionRequest_validateIfSubmitted.py
+18
-2
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
View file @
c61c99b9
...
...
@@ -40,6 +40,7 @@ if item.getPortalType() == 'Instance Tree':
'software_type/%s'
%
software_type
.
getRelativeUrl
()
]
resource_vcl
.
sort
()
project_value
=
item
.
getFollowUpValue
(
portal_type
=
"Project"
)
elif
item
.
getPortalType
()
==
'Compute Node'
:
service
=
portal
.
restrictedTraverse
(
'service_module/slapos_compute_node_subscription'
)
resource_vcl
=
None
...
...
@@ -59,7 +60,7 @@ if source_decision_value is None:
return
try
:
subscription_request
=
service
.
Resource_createSubscriptionRequest
(
source_decision_value
,
resource_vcl
)
subscription_request
=
service
.
Resource_createSubscriptionRequest
(
source_decision_value
,
resource_vcl
,
project_value
)
except
AssertionError
,
error
:
storeWorkflowComment
(
item
,
str
(
error
))
return
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Resource_createSubscriptionRequest.py
View file @
c61c99b9
...
...
@@ -4,13 +4,20 @@ resource = context
if
subscriber_person_value
is
None
:
raise
AssertionError
(
'Can not find a person profile'
)
project_value
=
None
source_project_value
=
None
destination_project_value
=
None
if
resource
.
getPortalType
()
==
"Software Product"
:
project_value
=
resource
.
getFollowUpValue
(
portal_type
=
"Project"
)
source_project_value
=
project_value
elif
resource
.
getPortalType
()
==
"Service"
:
if
resource
.
getRelativeUrl
()
not
in
(
"service_module/slapos_virtual_master_subscription"
,
"service_module/slapos_compute_node_subscription"
):
if
resource
.
getRelativeUrl
()
==
"service_module/slapos_compute_node_subscription"
:
if
project_value
is
None
:
raise
AssertionError
(
'A project is required for %s %s'
%
(
resource
.
getRelativeUrl
(),
project_value
))
destination_project_value
=
project_value
elif
resource
.
getRelativeUrl
()
==
"service_module/slapos_virtual_master_subscription"
:
if
project_value
is
not
None
:
raise
AssertionError
(
'No project is required for %s %s'
%
(
resource
.
getRelativeUrl
(),
project_value
))
else
:
raise
NotImplementedError
(
'Unsupported resource: %s'
%
resource
.
getRelativeUrl
())
else
:
raise
NotImplementedError
(
'Unsupported resource: %s'
%
resource
.
getRelativeUrl
())
...
...
@@ -35,7 +42,8 @@ tmp_sale_order = module.newContent(
destination_value
=
subscriber_person_value
,
destination_section
=
source_section
,
#destination_decision_value=source_decision_value,
destination_project_value
=
project_value
,
destination_project_value
=
destination_project_value
,
source_project_value
=
source_project_value
,
ledger_value
=
portal
.
portal_categories
.
ledger
.
automated
,
# XXX XXX destination_project_value=instance_tree.getFollowUpValue(),
)
...
...
@@ -62,7 +70,7 @@ else:
quantity
=
1
)
if
0
:
# XXX resource_vcl
:
if
variation_category_list
:
base_id
=
'movement'
cell_key
=
list
(
tmp_order_line
.
getCellKeyList
(
base_id
=
base_id
))[
0
]
tmp_order_cell
=
tmp_order_line
.
newCell
(
...
...
@@ -90,6 +98,7 @@ subscription_request = portal.subscription_request_module.newContent(
source_value
=
subscriber_person_value
,
source_section_value
=
source_section
,
source_decision_value
=
subscriber_person_value
,
source_project_value
=
source_project_value
,
start_date
=
now
,
effective_date
=
now
,
resource_value
=
resource
,
...
...
@@ -101,6 +110,7 @@ subscription_request = portal.subscription_request_module.newContent(
specialise_value
=
tmp_sale_order
.
getSpecialiseValue
(),
destination
=
tmp_sale_order
.
getSource
(),
destination_section
=
tmp_sale_order
.
getSourceSection
(),
destination_project_value
=
destination_project_value
,
price_currency
=
tmp_sale_order
.
getPriceCurrency
(),
price
=
price
,
# XXX activate_kw=activate_kw
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Resource_createSubscriptionRequest.xml
View file @
c61c99b9
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
subscriber_person_value, variation_category_list
</string>
</value>
<value>
<string>
subscriber_person_value, variation_category_list
, project_value
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
View file @
c61c99b9
...
...
@@ -7,7 +7,6 @@ if item is None:
customer
=
subscription_request
.
getSourceValue
()
if
resource
.
getPortalType
()
==
"Service"
:
if
resource
.
getRelativeUrl
()
==
"service_module/slapos_virtual_master_subscription"
:
# create the project
item
=
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
...
...
@@ -30,7 +29,7 @@ if item is None:
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'
seller
_project_%s'
%
item
.
getTitle
(),
reference
=
'
node
_project_%s'
%
item
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
destination_project_value
=
item
,
...
...
@@ -43,6 +42,23 @@ if item is None:
price_currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
#payment_condition_payment_mode='test-%s' % self.generateNewId()
)
sale_trade_condition
.
validate
()
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'instance_project_%s'
%
item
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
source_project_value
=
item
,
source_value
=
subscription_request
.
getDestinationValue
(),
#source_section_value=subscription_request.getDestinationSectionValue(),
#destination_section_value=subscription_request.getDestinationSectionValue(),
#source_section_value=seller_organisation,
#source_payment_value=seller_bank_account,
price_currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
#payment_condition_payment_mode='test-%s' % self.generateNewId()
)
"""
sale_trade_condition.newContent(
portal_type="Trade Model Line",
...
...
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