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
36484f10
Commit
36484f10
authored
Sep 19, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: wip script to create Support Request and Event
parent
8e31fea3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
0 deletions
+209
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
...m_monitoring/Project_createSupportRequestWithCausality.py
+24
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.xml
..._monitoring/Project_createSupportRequestWithCausality.xml
+62
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
..._skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
+61
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
...skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
+62
-0
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
0 → 100644
View file @
36484f10
portal
=
context
.
getPortalObject
()
project
=
context
causality_value
=
portal
.
restrictedTraverse
(
causality
)
support_request_in_progress
=
causality_value
.
Base_getSupportRequestInProgress
(
title
=
title
)
if
support_request_in_progress
is
not
None
:
return
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
,
causality
=
causality
,
# Ensure resoure is Monitoring
resource_value
=
portal
.
service_module
.
slapos_crm_monitoring
)
support_request
.
validate
()
return
support_request
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.xml
0 → 100644
View file @
36484f10
<?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>
title, text_content, causality, destination_decision
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Project_createSupportRequestWithCausality
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
0 → 100644
View file @
36484f10
"""Generic script to add event
It creates new Event for any context which become follow_up of created Event.
"""
portal
=
context
.
getPortalObject
()
ticket
=
context
if
direction
==
'outgoing'
:
source_relative_url
=
source
or
ticket
.
getSource
()
source_section_relative_url
=
ticket
.
getSourceSection
()
source_project_relative_url
=
ticket
.
getSourceProject
()
destination_relative_url
=
destination
or
ticket
.
getDestination
()
destination_section_relative_url
=
ticket
.
getDestinationSection
()
destination_project_relative_url
=
ticket
.
getDestinationProject
()
elif
direction
==
'incoming'
:
source_relative_url
=
source
or
ticket
.
getDestination
()
source_section_relative_url
=
ticket
.
getDestinationSection
()
source_project_relative_url
=
ticket
.
getDestinationProject
()
destination_relative_url
=
destination
or
ticket
.
getSource
()
destination_section_relative_url
=
ticket
.
getSourceSection
()
destination_project_relative_url
=
ticket
.
getSourceProject
()
else
:
raise
NotImplementedError
(
'The specified direction is not handled: %r'
%
(
direction
,))
event_kw
=
{
'portal_type'
:
portal_type
,
'title'
:
title
,
'resource'
:
resource
,
'source'
:
source_relative_url
,
'source_section'
:
source_section_relative_url
,
'source_project'
:
source_project_relative_url
,
'destination'
:
destination_relative_url
,
'destination_section'
:
destination_section_relative_url
,
'destination_project'
:
destination_project_relative_url
,
'start_date'
:
DateTime
(),
'follow_up_value'
:
ticket
,
'language'
:
language
,
'text_content'
:
text_content
,
'content_type'
:
content_type
,
}
# Create event
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
event
=
module
.
newContent
(
**
event_kw
)
if
notification_message
:
event
.
Event_setTextContentFromNotificationMessage
(
notification_message
,
language
=
language
,
substitution_method_parameter_dict
=
substitution_method_parameter_dict
)
if
not
keep_draft
:
if
direction
==
'incoming'
:
# Support event_workflow and event_simulation_workflow
if
portal
.
portal_workflow
.
isTransitionPossible
(
event
,
'receive'
):
event
.
receive
()
if
portal
.
portal_workflow
.
isTransitionPossible
(
event
,
'stop'
):
event
.
stop
()
else
:
event
.
plan
()
return
event
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
0 → 100644
View file @
36484f10
<?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>
title, direction, portal_type, resource, text_content, content_type, notification_message=None, substitution_method_parameter_dict=None, keep_draft=False, source=None, destination=None, language=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Ticket_createProjectEvent
</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