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
756f8e66
Commit
756f8e66
authored
Apr 05, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: create Open Sale Order from Subscription Request
parent
2216eebb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
0 deletions
+150
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
...os_subscription_request/Item_createSubscriptionRequest.py
+3
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createOpenSaleOrder.py
...iption_request/SubscriptionRequest_createOpenSaleOrder.py
+85
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createOpenSaleOrder.xml
...ption_request/SubscriptionRequest_createOpenSaleOrder.xml
+62
-0
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
View file @
756f8e66
...
...
@@ -153,4 +153,7 @@ subscription_request.submit()
if
len
(
subscription_request
.
checkConsistency
())
!=
0
:
raise
NotImplementedError
(
subscription_request
.
checkConsistency
())
subscription_request
.
SubscriptionRequest_createOpenSaleOrder
()
subscription_request
.
validate
()
return
subscription_request
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createOpenSaleOrder.py
0 → 100644
View file @
756f8e66
portal
=
context
.
getPortalObject
()
subscription_request
=
context
activate_kw
=
None
#######################################################
# Hosting Subscription
hosting_subscription
=
portal
.
hosting_subscription_module
.
newContent
(
portal_type
=
"Hosting Subscription"
,
title
=
"hosting %s"
%
subscription_request
.
getTitle
(),
#follow_up_value=instance_tree.getFollowUpValue(),
ledger_value
=
portal
.
portal_categories
.
ledger
.
automated
,
)
hosting_subscription
.
validate
()
#######################################################
# Open Sale Order
start_date
=
hosting_subscription
.
HostingSubscription_calculateSubscriptionStartDate
()
open_sale_order
=
portal
.
open_sale_order_module
.
newContent
(
portal_type
=
"Open Sale Order"
,
start_date
=
start_date
,
# Ensure stop date value is higher than start date
# it will be updated by OpenSaleOrder_updatePeriod
stop_date
=
start_date
+
1
,
specialise_value
=
subscription_request
.
getSpecialiseValue
(),
source_value
=
subscription_request
.
getDestinationValue
(),
source_section_value
=
subscription_request
.
getDestinationSectionValue
(),
source_decision_value
=
subscription_request
.
getDestinationDecisionValue
(),
source_project_value
=
subscription_request
.
getDestinationProjectValue
(),
destination_value
=
subscription_request
.
getSourceValue
(),
destination_section_value
=
subscription_request
.
getSourceSectionValue
(),
destination_decision_value
=
subscription_request
.
getSourceDecisionValue
(),
destination_project_value
=
subscription_request
.
getSourceProjectValue
(),
ledger_value
=
portal
.
portal_categories
.
ledger
.
automated
,
causality_value
=
subscription_request
,
price_currency_value
=
subscription_request
.
getPriceCurrencyValue
(),
activate_kw
=
activate_kw
)
variation_category_list
=
subscription_request
.
getVariationCategoryList
()
open_order_line
=
open_sale_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
,
resource_value
=
subscription_request
.
getResourceValue
(),
variation_category_list
=
variation_category_list
,
quantity_unit_value
=
subscription_request
.
getQuantityUnitValue
(),
base_contribution_list
=
subscription_request
.
getBaseContributionList
(),
use
=
subscription_request
.
getUse
(),
activate_kw
=
activate_kw
)
if
variation_category_list
:
base_id
=
'path'
cell_key
=
list
(
open_order_line
.
getCellKeyList
(
base_id
=
base_id
))[
0
]
open_order_cell
=
open_order_line
.
newCell
(
base_id
=
base_id
,
portal_type
=
"Open Sale Order Cell"
,
*
cell_key
)
open_order_cell
.
edit
(
mapped_value_property_list
=
[
'price'
,
'quantity'
],
predicate_category_list
=
cell_key
,
variation_category_list
=
cell_key
,
activate_kw
=
activate_kw
)
else
:
open_order_cell
=
open_order_line
open_order_cell
.
edit
(
quantity
=
subscription_request
.
getQuantity
(),
price
=
subscription_request
.
getPrice
(),
aggregate_value_list
=
[
hosting_subscription
,
subscription_request
.
getAggregateValue
()
],
activate_kw
=
activate_kw
)
open_sale_order
.
OpenSaleOrder_updatePeriod
()
open_sale_order
.
plan
()
open_sale_order
.
validate
()
return
open_sale_order
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createOpenSaleOrder.xml
0 → 100644
View file @
756f8e66
<?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_createOpenSaleOrder
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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