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
Roque
slapos.core
Commits
407b5fcb
Commit
407b5fcb
authored
Jun 10, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: add some assertions before claiming a subscription
parent
86242ed1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_claimSlaposItemSubscription.py
..._skins/slapos_panel/Person_claimSlaposItemSubscription.py
+14
-3
No files found.
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_claimSlaposItemSubscription.py
View file @
407b5fcb
...
...
@@ -27,12 +27,13 @@ if len(sql_instance_list) != 1:
# Search for the existing Open Sale Order
item
=
sql_instance_list
[
0
].
getObject
()
open_sale_order_cell
=
portal
.
portal_catalog
.
getResultValue
(
open_sale_order_cell
_list
=
portal
.
portal_catalog
(
portal_type
=
[
'Open Sale Order Line'
,
'Open Sale Order Cell'
],
aggregate__uid
=
item
.
getUid
(),
validation_state
=
'validated'
validation_state
=
'validated'
,
limit
=
2
)
if
open_sale_order_cell
is
None
:
if
len
(
open_sale_order_cell_list
)
==
0
:
keep_items
=
{
'your_reference'
:
reference
,
'portal_status_level'
:
'warning'
,
...
...
@@ -41,7 +42,17 @@ if open_sale_order_cell is None:
if
batch
:
raise
ValueError
(
keep_items
[
'portal_status_message'
])
return
context
.
Base_renderForm
(
dialog_id
,
keep_items
=
keep_items
)
elif
len
(
open_sale_order_cell_list
)
==
2
:
keep_items
=
{
'your_reference'
:
reference
,
'portal_status_level'
:
'warning'
,
'portal_status_message'
:
Base_translateString
(
'Too many Open Sale Orders found'
)
}
if
batch
:
raise
ValueError
(
keep_items
[
'portal_status_message'
])
return
context
.
Base_renderForm
(
dialog_id
,
keep_items
=
keep_items
)
open_sale_order_cell
=
open_sale_order_cell_list
[
0
].
getObject
()
open_sale_order
=
open_sale_order_cell
.
getParentValue
()
while
open_sale_order
.
getPortalType
()
!=
'Open Sale Order'
:
open_sale_order
=
open_sale_order
.
getParentValue
()
...
...
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