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
bc3e5d52
Commit
bc3e5d52
authored
Apr 11, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: alarm to validate submitted Subscription Request
parent
7d160ce7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
303 additions
and
0 deletions
+303
-0
master/bt5/slapos_subscription_request/PathTemplateItem/portal_alarms/slapos_subscription_request_validate_submitted.xml
...alarms/slapos_subscription_request_validate_submitted.xml
+97
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Alarm_validateSubmittedSubscriptionRequest.py
...ion_request/Alarm_validateSubmittedSubscriptionRequest.py
+11
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Alarm_validateSubmittedSubscriptionRequest.xml
...on_request/Alarm_validateSubmittedSubscriptionRequest.xml
+62
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
...iption_request/SubscriptionRequest_validateIfSubmitted.py
+70
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.xml
...ption_request/SubscriptionRequest_validateIfSubmitted.xml
+62
-0
master/bt5/slapos_subscription_request/bt/template_path_list
master/bt5/slapos_subscription_request/bt/template_path_list
+1
-0
No files found.
master/bt5/slapos_subscription_request/PathTemplateItem/portal_alarms/slapos_subscription_request_validate_submitted.xml
0 → 100644
View file @
bc3e5d52
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Alarm"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_validateSubmittedSubscriptionRequest
</string>
</value>
</item>
<item>
<key>
<string>
automatic_solve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_subscription_request_validate_submitted
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<tuple>
<float>
1677632460.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Validate submitted Subscription Request
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Alarm_validateSubmittedSubscriptionRequest.py
0 → 100644
View file @
bc3e5d52
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
'SubscriptionRequest_validateIfSubmitted'
,
# Project are created only from UI for now
portal_type
=
[
"Subscription Request"
],
simulation_state
=
'submitted'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Alarm_validateSubmittedSubscriptionRequest.xml
0 → 100644
View file @
bc3e5d52
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_validateSubmittedSubscriptionRequest
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.py
0 → 100644
View file @
bc3e5d52
subscription_request
=
context
portal
=
context
.
getPortalObject
()
item
=
subscription_request
.
getAggregateValue
()
if
item
is
None
:
resource
=
subscription_request
.
getResourceValue
()
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'
,
)
item
.
validate
()
# and create default assignments for the user
# who can manage compute nodes and create instances
customer
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
item
,
function
=
'production/manager'
).
open
()
customer
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
item
,
function
=
'customer'
).
open
()
sale_trade_condition
=
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'seller_project_%s'
%
item
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
destination_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",
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',),
membership_criterion_category=('price_currency/%s' % currency.getRelativeUrl(),)
)"""
sale_trade_condition
.
validate
()
else
:
raise
ValueError
(
'Unsupported resource: %s'
%
resource
.
getRelativeUrl
())
else
:
raise
ValueError
(
'Unsupported resource: %s'
%
resource
.
getRelativeUrl
())
# Use list setter, to ensure it crashes if item is still None
subscription_request
.
setAggregateValueList
([
item
])
subscription_request
.
SubscriptionRequest_createOpenSaleOrder
()
subscription_request
.
validate
()
subscription_request
.
invalidate
()
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_validateIfSubmitted.xml
0 → 100644
View file @
bc3e5d52
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SubscriptionRequest_validateIfSubmitted
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/bt/template_path_list
View file @
bc3e5d52
...
...
@@ -8,5 +8,6 @@ accounting_module/template_wechat_pre_payment_subscription_sale_invoice_transact
accounting_module/template_wechat_pre_payment_subscription_sale_invoice_transaction/**
portal_alarms/slapos_subscription_request_create_from_orphaned_item
portal_alarms/slapos_subscription_request_process_**
portal_alarms/slapos_subscription_request_validate_submitted
portal_alarms/slapos_update_subscription_request_consistency_state
service_module/slapos_reservation_fee_2
\ No newline at end of file
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