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
655a3d5a
Commit
655a3d5a
authored
Sep 19, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: search a matching Trade Condition to generate a Support Request
parent
4ff8e715
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
...m_monitoring/Project_createSupportRequestWithCausality.py
+34
-4
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
View file @
655a3d5a
...
...
@@ -9,16 +9,46 @@ support_request_in_progress = causality_value.Base_getSupportRequestInProgress(
if
support_request_in_progress
is
not
None
:
return
# Create a temp Sale Order to find the trade condition
now
=
DateTime
()
module
=
portal
.
portal_trash
tmp_sale_order
=
module
.
newContent
(
portal_type
=
'Sale Order'
,
temp_object
=
True
,
trade_condition_type
=
"ticket"
,
start_date
=
now
,
destination
=
destination_decision
,
destination_decision
=
destination_decision
,
source_project_value
=
project
,
ledger_value
=
portal
.
portal_categories
.
ledger
.
automated
)
tmp_sale_order
.
SaleOrder_applySaleTradeCondition
(
batch_mode
=
1
,
force
=
1
)
"""
if tmp_sale_order.getSpecialise(None) is None:
raise AssertionError('Can not find a trade condition to generate the Support Request')
"""
resource
=
portal
.
service_module
.
slapos_crm_monitoring
support_request
=
portal
.
support_request_module
.
newContent
(
portal_type
=
"Support Request"
,
title
=
title
,
description
=
text_content
,
start_date
=
DateTime
(),
source_project_value
=
project
,
destination_decision
=
destination_decision
,
start_date
=
tmp_sale_order
.
getStartDate
(),
source
=
tmp_sale_order
.
getSource
(),
source_section
=
tmp_sale_order
.
getSourceSection
(),
source_project
=
tmp_sale_order
.
getSourceProject
(),
destination
=
tmp_sale_order
.
getDestination
(),
destination_section
=
tmp_sale_order
.
getDestinationSection
(),
destination_project
=
tmp_sale_order
.
getDestinationProject
(),
destination_decision
=
tmp_sale_order
.
getDestinationDecision
(),
specialise
=
tmp_sale_order
.
getSpecialise
(),
causality
=
causality
,
# Ensure resoure is Monitoring
resource_value
=
portal
.
service_module
.
slapos_crm_monitoring
resource_value
=
resource
,
quantity_unit
=
resource
.
getQuantityUnit
(),
base_contribution_list
=
resource
.
getBaseContributionList
(),
use
=
resource
.
getUse
(),
quantity
=
1
,
price
=
0
)
support_request
.
validate
()
return
support_request
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