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
f8b48a03
Commit
f8b48a03
authored
Jan 13, 2025
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: create draft Sale Supply when creating a "payable" project
parent
c4e940f6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
88 deletions
+92
-88
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
..._components/test.erp5.testSlapOSERP5AccountingScenario.py
+20
-17
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
.../portal_components/test.erp5.testSlapOSERP5CRMScenario.py
+9
-11
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
...t.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
+8
-11
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionScenario.py
...omponents/test.erp5.testSlapOSERP5SubscriptionScenario.py
+24
-28
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+16
-21
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_addVirtualMaster.py
...Item/portal_skins/slapos_panel/Person_addVirtualMaster.py
+15
-0
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
View file @
f8b48a03
...
...
@@ -20,9 +20,10 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
owner_person
,
_
,
project
=
self
.
bootstrapAccountingTest
()
# Ensure no unexpected object has been created
# 2 assignment
# 2 sale supply + line
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
5
)
self
.
assertRelatedObjectCount
(
project
,
7
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
())
...
...
@@ -75,10 +76,11 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 open order
# 2 assignment
# 2 simulation movements
# 2 sale supply + line
# 1 sale packing list
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
1
0
)
self
.
assertRelatedObjectCount
(
project
,
1
2
)
with
PinnedDateTime
(
self
,
DateTime
(
'2021/07/05'
)):
self
.
portal
.
portal_alarms
.
update_open_order_simulation
.
activeSense
()
...
...
@@ -98,10 +100,11 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 open order
# 2 assignment
# 8 simulation movements
# 2 sale supply + line
# 4 sale packing list
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
2
2
)
self
.
assertRelatedObjectCount
(
project
,
2
4
)
# Try to pay previous period
with
PinnedDateTime
(
self
,
DateTime
(
'2021/07/06'
)):
...
...
@@ -128,7 +131,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertTrue
(
first_invoice
.
SaleInvoiceTransaction_isLettered
())
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
2
2
)
self
.
assertRelatedObjectCount
(
project
,
2
4
)
payment_tag
=
"Entity_createPaymentTransaction_%s"
%
owner_person
.
getUid
()
owner_person
.
REQUEST
.
set
(
payment_tag
,
None
)
...
...
@@ -152,7 +155,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
(
len
(
amount_list
),
0
)
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
2
2
)
self
.
assertRelatedObjectCount
(
project
,
2
4
)
with
PinnedDateTime
(
self
,
DateTime
(
'2021/07/06'
)):
self
.
checkERP5StateBeforeExit
()
...
...
@@ -173,22 +176,20 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
"instance product"
,
project
,
software_release_url
,
software_type
)
# Create supply to buy services
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
7
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
6
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
7
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
self
.
tic
()
# Ensure no unexpected object has been created
...
...
@@ -324,9 +325,10 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# Ensure no unexpected object has been created
# 2 assignment
# 2 sale supply + line
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
5
)
self
.
assertRelatedObjectCount
(
project
,
7
)
##################################################
# Add deposit (0.1 to prevent discount generation)
...
...
@@ -371,9 +373,10 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 open order
# 2 assignment
# 4 simulation movements
# 2 sale supply + line
# 2 sale packing lists
# 2 sale trade condition
# 1 subscription requests
self
.
assertRelatedObjectCount
(
project
,
1
4
)
self
.
assertRelatedObjectCount
(
project
,
1
6
)
self
.
checkERP5StateBeforeExit
()
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
View file @
f8b48a03
...
...
@@ -37,23 +37,21 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
software_product
,
_
,
_
=
self
.
addSoftwareProduct
(
"instance product"
,
project
,
software_release_url
,
software_type
)
# Create supply to buy services
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
7
)
# Create supply to buy services
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
6
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
7
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
self
.
tic
()
# Ensure no unexpected object has been created
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
View file @
f8b48a03
...
...
@@ -314,18 +314,15 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# create a default project
project_relative_url
=
self
.
addProject
(
person
=
owner_person
,
currency
=
currency
,
is_accountable
=
True
)
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project_relative_url
,
source_project
=
project_relative_url
,
price_currency_value
=
currency
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__relative_url
=
project_relative_url
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
99
)
sale_supply
.
validate
()
self
.
logout
()
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionScenario.py
View file @
f8b48a03
...
...
@@ -86,11 +86,10 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
...
...
@@ -249,12 +248,12 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
# 5 (can reduce to 2) assignment
# 2 simulation mvt
# 1 packing list / line
#
2
sale supply / line
#
3
sale supply / line
# 2 sale trade condition
# 1 software installation
# 1 software product
# 2 subscription requests
self
.
assertRelatedObjectCount
(
project
,
2
1
)
self
.
assertRelatedObjectCount
(
project
,
2
2
)
self
.
checkERP5StateBeforeExit
()
...
...
@@ -352,9 +351,10 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
# Ensure no unexpected object has been created
# 1 credential request
# 4 assignment
# 2 Sale Supply + Line
# 2 Sale Trade condition
# 1 subscription request
self
.
assertRelatedObjectCount
(
project
,
8
)
self
.
assertRelatedObjectCount
(
project
,
10
)
self
.
checkERP5StateBeforeExit
()
def
test_subscription_request_cancel_after_compute_node_is_invalidated
(
self
):
...
...
@@ -405,22 +405,20 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
99
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
9
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
self
.
tic
()
...
...
@@ -694,22 +692,20 @@ class TestSlapOSSubscriptionScenario(TestSlapOSSubscriptionScenarioMixin):
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
99
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
9
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
self
.
tic
()
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
f8b48a03
...
...
@@ -611,22 +611,20 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
99
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
9
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
# some preparation
...
...
@@ -736,7 +734,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
public_reference
).
getParentValue
()
self
.
login
(
owner_person
.
getUserId
())
# and the instances
self
.
checkInstanceUnallocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
...
...
@@ -853,22 +850,20 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
self
.
tic
()
sale_supply
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Supply'
,
source_project__uid
=
project
.
getUid
()
)
sale_supply
.
searchFolder
(
portal_type
=
'Sale Supply Line'
,
resource__relative_url
=
"service_module/slapos_compute_node_subscription"
)[
0
].
edit
(
base_price
=
99
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
9
,
resource_value
=
software_product
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
self
.
tic
()
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_addVirtualMaster.py
View file @
f8b48a03
...
...
@@ -110,6 +110,21 @@ sale_trade_condition = portal.sale_trade_condition_module.newContent(
)
sale_trade_condition
.
validate
()
if
is_compute_node_payable
or
is_instance_tree_payable
:
# Create a draft sale supply to buy nodes / instances
# Sale Manager must manually enter the prices on it and validate
sale_supply
=
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"Project Prices for %s"
%
project
.
getReference
(),
source_project_value
=
project
,
price_currency_value
=
currency_value
)
if
is_compute_node_payable
:
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
resource
=
"service_module/slapos_compute_node_subscription"
)
if
batch
:
return
project
return
project
.
Base_redirect
()
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