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
10901d12
Commit
10901d12
authored
Nov 28, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: allow to run the migration multiple time
parent
5b6886a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
41 deletions
+47
-41
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_triggerFullSiteMigrationToVirtualMaster.py
..._upgrader/Base_triggerFullSiteMigrationToVirtualMaster.py
+38
-33
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ProjectModule_triggerObjectMigrationToVirtualMaster.py
...er/ProjectModule_triggerObjectMigrationToVirtualMaster.py
+9
-8
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Base_triggerFullSiteMigrationToVirtualMaster.py
View file @
10901d12
...
...
@@ -4,40 +4,45 @@ tag = script.id
### Create the bootstrap Trade Condition
currency
=
portal
.
restrictedTraverse
(
'currency_module/EUR'
)
seller_organisation
=
portal
.
restrictedTraverse
(
'organisation_module/rapidspace'
)
business_process
=
portal
.
restrictedTraverse
(
'business_process_module/slapos_ultimate_business_process'
)
# Sale Trade Condition for Tax
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
"Tax/payment for: %s"
%
currency
.
getRelativeUrl
(),
trade_condition_type
=
"default"
,
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
price_currency_value
=
currency
)
sale_trade_condition
.
newContent
(
portal_type
=
"Trade Model Line"
,
reference
=
"VAT"
,
resource
=
"service_module/slapos_tax"
,
base_application
=
"base_amount/invoicing/taxable"
,
trade_phase
=
"slapos/tax"
,
price
=
0.2
,
quantity
=
1.0
,
membership_criterion_base_category
=
(
'price_currency'
,
'base_contribution'
),
membership_criterion_category
=
(
'price_currency/%s'
%
currency
.
getRelativeUrl
(),
'base_contribution/base_amount/invoicing/taxable'
)
)
sale_trade_condition
.
validate
()
sale_trade_condition
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
if
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Trade Condition'
,
specialise__uid
=
business_process
.
getUid
()
)
is
None
:
# Sale Trade Condition for Tax
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
"Tax/payment for: %s"
%
currency
.
getRelativeUrl
(),
trade_condition_type
=
"default"
,
# XXX hardcoded
specialise_value
=
business_process
,
price_currency_value
=
currency
)
sale_trade_condition
.
newContent
(
portal_type
=
"Trade Model Line"
,
reference
=
"VAT"
,
resource
=
"service_module/slapos_tax"
,
base_application
=
"base_amount/invoicing/taxable"
,
trade_phase
=
"slapos/tax"
,
price
=
0.2
,
quantity
=
1.0
,
membership_criterion_base_category
=
(
'price_currency'
,
'base_contribution'
),
membership_criterion_category
=
(
'price_currency/%s'
%
currency
.
getRelativeUrl
(),
'base_contribution/base_amount/invoicing/taxable'
)
)
sale_trade_condition
.
validate
()
sale_trade_condition
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
# Create Trade Condition to create Project
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
"Free Virtual Master (%s)"
%
seller_organisation
.
getTitle
(),
trade_condition_type
=
"virtual_master"
,
specialise_value
=
sale_trade_condition
,
source_value
=
seller_organisation
,
price_currency_value
=
currency
,
)
sale_trade_condition
.
validate
()
sale_trade_condition
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
# Create Trade Condition to create Project
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
"Free Virtual Master (%s)"
%
seller_organisation
.
getTitle
(),
trade_condition_type
=
"virtual_master"
,
specialise_value
=
sale_trade_condition
,
source_value
=
seller_organisation
,
price_currency_value
=
currency
,
)
sale_trade_condition
.
validate
()
sale_trade_condition
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
return
context
.
activate
(
after_tag
=
tag
).
Base_triggerFullSiteMigrationToVirtualMasterStep2
()
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ProjectModule_triggerObjectMigrationToVirtualMaster.py
View file @
10901d12
...
...
@@ -17,14 +17,15 @@ for sql_result in portal.portal_catalog(
portal_type
=
"Subscription Request"
,
):
subscription_request
=
sql_result
.
getObject
()
instance_tree
=
subscription_request
.
getAggregateValue
(
portal_type
=
"Instance Tree"
)
if
(
instance_tree
is
not
None
):
context
.
log
(
'COUSCOUS %s'
%
subscription_request
.
getRelativeUrl
())
# Build the list of prices per project/software release
project_guid
=
instance_tree
.
getSuccessorValue
().
getSlaXmlAsDict
().
get
(
'project_guid'
,
None
)
if
project_guid
is
not
None
:
payable_project_guid_dict
[
project_guid
]
=
subscription_request
.
getPriceCurrency
()
if
subscription_request
.
getSpecialise
(
''
).
startswith
(
'subscription_condition'
):
instance_tree
=
subscription_request
.
getAggregateValue
(
portal_type
=
"Instance Tree"
)
if
(
instance_tree
is
not
None
):
context
.
log
(
'COUSCOUS %s'
%
subscription_request
.
getRelativeUrl
())
# Build the list of prices per project/software release
project_guid
=
instance_tree
.
getSuccessorValue
().
getSlaXmlAsDict
().
get
(
'project_guid'
,
None
)
if
project_guid
is
not
None
:
payable_project_guid_dict
[
project_guid
]
=
subscription_request
.
getPriceCurrency
()
# Delete existing subscription request, which must be recreated later
subscription_request
.
getParentValue
().
manage_delObjects
(
ids
=
[
subscription_request
.
getId
()])
...
...
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