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
180a1777
Commit
180a1777
authored
Sep 28, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: no need to manually handle the notification message
parent
510fd11d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
28 deletions
+12
-28
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
...s/slapos_crm/Person_checkToCreateRegularisationRequest.py
+12
-28
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.py
View file @
180a1777
...
@@ -23,6 +23,7 @@ ticket = portal.portal_catalog.getResultValue(
...
@@ -23,6 +23,7 @@ ticket = portal.portal_catalog.getResultValue(
if
ticket
is
not
None
:
if
ticket
is
not
None
:
return
ticket
,
None
return
ticket
,
None
mail_message
=
None
outstanding_amount
=
person
.
Entity_statSlapOSOutstandingAmount
()
outstanding_amount
=
person
.
Entity_statSlapOSOutstandingAmount
()
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
...
@@ -55,43 +56,26 @@ if int(outstanding_amount) > 0:
...
@@ -55,43 +56,26 @@ if int(outstanding_amount) > 0:
ticket
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
ticket
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
# Notify using user's language
subject
=
'Invoice payment requested'
language
=
context
.
getLanguage
(
"en"
)
body
=
"""Dear %s,
notification_message
=
context
.
getPortalObject
().
portal_notifications
.
getDocumentValue
(
A new invoice has been generated.
reference
=
"slapos-crm.create.regularisation.request"
,
language
=
language
)
if
notification_message
is
None
:
subject
=
'Invoice payment requested'
body
=
"""Dear %s,
A new invoice has been generated.
You can access it in your invoice section at %s.
You can access it in your invoice section at %s.
Regards,
Regards,
The slapos team
The slapos team
"""
%
(
context
.
getTitle
(),
portal
.
portal_preferences
.
getPreferredSlaposWebSiteUrl
())
"""
%
(
context
.
getTitle
(),
portal
.
portal_preferences
.
getPreferredSlaposWebSiteUrl
())
notification_message_reference
=
"slapos-crm.create.regularisation.request"
else
:
notification_mapping_dict
=
{
'user_name'
:
context
.
getTitle
()}
subject
=
notification_message
.
getTitle
()
# Preserve HTML else convert to text
if
notification_message
.
getContentType
()
==
"text/html"
:
body
=
notification_message
.
asEntireHTML
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
notification_mapping_dict
})
else
:
body
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
notification_mapping_dict
})
mail_message
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
mail_message
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
portal
.
portal_preferences
.
getPreferredRegularisationRequestResource
(),
portal
.
portal_preferences
.
getPreferredRegularisationRequestResource
(),
subject
,
subject
,
body
,
body
,
'Requested manual payment.'
)
'Requested manual payment.'
,
notification_message
=
notification_message_reference
,
return
ticket
,
mail_message
substitution_method_parameter_dict
=
{
'user_name'
:
context
.
getTitle
()
},
)
return
ticket
,
Non
e
return
ticket
,
mail_messag
e
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