Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
53b80186
Commit
53b80186
authored
Dec 20, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust Mail Message sending by activity
parent
f4d41130
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
25 deletions
+24
-25
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
...nTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
+4
-11
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/MailMessage_sendByActivity.xml
...tem/portal_skins/erp5_base/MailMessage_sendByActivity.xml
+3
-3
bt5/erp5_base/bt/revision
bt5/erp5_base/bt/revision
+1
-1
product/ERP5/tests/testCRM.py
product/ERP5/tests/testCRM.py
+16
-10
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/MailMessage_send.xml
View file @
53b80186
...
...
@@ -135,19 +135,12 @@ if download or not use_activity:\n
context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n
\n
if use_activity:\n
destination_list = context.getDestinationValueList()\n
path_list = [x.getPath() for x in destination_list]\n
uid_list = [x.getUid() for x in destination_list]\n
method_kw = dict(event_relative_url=context.getRelativeUrl(),\n
from_url=from_url,\n
attachment_list=attachment_list)\n
from_url=from_url,\n
attachment_list=attachment_list)\n
context.activate(\n
after_path_and_method_id=(path_list, \n
# XXX Event_sendByActivity only applies to Mail Message at the moment.\n
# We should either renamted it to MailMessage_ or make this logic available to \n
# all kind of events.\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).Event_sendByActivity(\n
uid_list=uid_list,\n
after_path_and_method_id=((context.getPath(),), \n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).MailMessage_sendByActivity(\n
method_kw=method_kw, **kw)\n
\n
if download:\n
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/
Event
_sendByActivity.xml
→
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/
MailMessage
_sendByActivity.xml
View file @
53b80186
...
...
@@ -52,13 +52,13 @@
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id="Entity_sendEmail",\n
uid=uid_list
,\n
destination_related_uid=context.getUid()
,\n
method_kw=method_kw, **kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
uid_list,
method_kw, **kw
</string>
</value>
<value>
<string>
method_kw, **kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
@@ -70,7 +70,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Event
_sendByActivity
</string>
</value>
<value>
<string>
MailMessage
_sendByActivity
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_base/bt/revision
View file @
53b80186
1062
\ No newline at end of file
1064
\ No newline at end of file
product/ERP5/tests/testCRM.py
View file @
53b80186
...
...
@@ -1764,28 +1764,34 @@ class TestCRMMailSend(BaseTestCRM):
self
.
tic
()
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Mail Message"
)
relative_url_list
=
[
z
.
getRelativeUrl
()
for
z
in
self
.
portal
.
person_module
.
searchFolder
()]
self
.
assertEquals
(
3
,
len
(
relative_url_list
))
mail_message
.
setDestinationList
(
relative_url_list
)
mail_message
.
setSource
(
relative_url_list
[
0
])
mail_text_content
=
"Body Text Content"
mail_message
.
setTextContent
(
mail_text_content
)
self
.
portal
.
portal_workflow
.
doActionFor
(
mail_message
,
"start_action"
)
self
.
tic
()
mail_message
.
Event_send
(
packet_size
=
2
)
# directly call MailMessage_send to pass a packet size of 1, so that we
# have one activity per recipient
mail_message
.
MailMessage_send
(
packet_size
=
1
)
self
.
commit
()
portal_activities
=
self
.
portal
.
portal_activities
portal_activities
.
manageInvoke
(
object_path
=
mail_message
.
getPath
(),
method_id
=
'Event_sendByActivity'
)
portal_activities
.
manageInvoke
(
object_path
=
mail_message
.
getPath
(),
method_id
=
'immediateReindexObject'
)
portal_activities
.
manageInvoke
(
object_path
=
mail_message
.
getPath
(),
method_id
=
'MailMessage_sendByActivity'
)
self
.
commit
()
message_list
=
[
i
for
i
in
portal_activities
.
getMessageList
()
\
if
i
.
kw
.
has_key
(
"event_relative_url"
)]
try
:
self
.
assertEquals
(
2
,
len
(
message_list
))
# 3 recipients -> 3 activities
self
.
assertEquals
(
3
,
len
(
message_list
))
finally
:
self
.
tic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertTrue
(
mail_text_content
in
last_message
[
-
1
])
message
=
message_from_string
(
last_message
[
-
1
])
last_message_date
=
DateTime
(
message
.
get
(
"Date"
))
self
.
assertTrue
(
last_message_date
.
isCurrentDay
())
self
.
assertEquals
(
3
,
len
(
self
.
portal
.
MailHost
.
_message_list
))
for
message_info
in
self
.
portal
.
MailHost
.
_message_list
:
self
.
assertTrue
(
mail_text_content
in
message_info
[
-
1
])
message
=
message_from_string
(
message_info
[
-
1
])
self
.
assertTrue
(
DateTime
(
message
.
get
(
"Date"
)).
isCurrentDay
())
def
test_MailMessage_send_simple_case
(
self
):
"""
...
...
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