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
0c8fd7f1
Commit
0c8fd7f1
authored
Sep 28, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: create the Regularisation Request from a Trade Condition instead of a template
parent
8b465f5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
53 deletions
+124
-53
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
...s/slapos_crm/Person_checkToCreateRegularisationRequest.py
+8
-11
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Entity_createTicketFromTradeCondition.py
...s_crm_monitoring/Entity_createTicketFromTradeCondition.py
+46
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Entity_createTicketFromTradeCondition.xml
..._crm_monitoring/Entity_createTicketFromTradeCondition.xml
+62
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
...m_monitoring/Project_createSupportRequestWithCausality.py
+8
-42
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
View file @
0c8fd7f1
...
...
@@ -41,18 +41,15 @@ if int(outstanding_amount) > 0:
person
.
serialize
()
# Time to create the ticket
regularisation_request_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredRegularisationRequestTemplate
())
ticket
=
regularisation_request_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
ticket
.
edit
(
title
=
'Account regularisation expected for "%s"'
%
context
.
getTitle
(),
destination_decision_value
=
context
,
destination_value
=
context
,
start_date
=
DateTime
(),
resource
=
portal
.
portal_preferences
.
getPreferredRegularisationRequestResource
(),
comment
=
'New automatic ticket for %s'
%
context
.
getTitle
()
ticket
=
context
.
Entity_createTicketFromTradeCondition
(
portal
.
service_module
.
slapos_crm_monitoring
.
getRelativeUrl
(),
'Account regularisation expected for "%s"'
%
context
.
getTitle
(),
''
,
portal_type
=
'Regularisation Request'
,
comment
=
comment
)
ticket
.
validate
(
comment
=
'New automatic ticket for %s'
%
context
.
getTitle
())
ticket
.
suspend
(
comment
=
'New automatic ticket for %s'
%
context
.
getTitle
())
ticket
.
suspend
(
comment
=
comment
)
ticket
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Entity_createTicketFromTradeCondition.py
0 → 100644
View file @
0c8fd7f1
portal
=
context
.
getPortalObject
()
destination_decision_value
=
context
# 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_value
=
destination_decision_value
,
destination_decision_value
=
destination_decision_value
,
source_project
=
source_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
.
restrictedTraverse
(
resource
)
ticket
=
portal
.
getDefaultModule
(
portal_type
).
newContent
(
portal_type
=
portal_type
,
title
=
title
,
description
=
text_content
,
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
=
resource
,
quantity_unit
=
resource
.
getQuantityUnit
(),
base_contribution_list
=
resource
.
getBaseContributionList
(),
use
=
resource
.
getUse
(),
quantity
=
1
,
price
=
0
)
ticket
.
validate
(
comment
=
comment
)
return
ticket
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Entity_createTicketFromTradeCondition.xml
0 → 100644
View file @
0c8fd7f1
<?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>
resource, title, text_content, portal_type=\'Support Request\', source_project=None, causality=None, comment=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Entity_createTicketFromTradeCondition
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Project_createSupportRequestWithCausality.py
View file @
0c8fd7f1
...
...
@@ -6,46 +6,12 @@ causality_value = portal.restrictedTraverse(causality)
if
causality_value
.
Base_getSupportRequestInProgress
(
title
=
title
)
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
=
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
=
resource
,
quantity_unit
=
resource
.
getQuantityUnit
(),
base_contribution_list
=
resource
.
getBaseContributionList
(),
use
=
resource
.
getUse
(),
quantity
=
1
,
price
=
0
destination_decision_value
=
portal
.
restrictedTraverse
(
destination_decision
)
return
destination_decision_value
.
Entity_createTicketFromTradeCondition
(
portal
.
service_module
.
slapos_crm_monitoring
.
getRelativeUrl
(),
title
,
text_content
,
source_project
=
project
.
getRelativeUrl
(),
causality
=
causality
)
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