Commit 575004c1 authored by Gabriel Monnerat's avatar Gabriel Monnerat

Changes to fix test_store_as_event from testNotificationTool and...

Changes to fix test_store_as_event from testNotificationTool and testMailFromMailMessageEvent from testERP5Credential

after_path_and_method_id argument was added to not activate when Crededial
request object is not indexed yet. This is needed because when the method
searchAndActivate from catalog is called, if the object is not indexed, the
e-mail is not sent.

And extended script Entity_sendEmail to use from_url parameter when it is not
None. This case happens when the sender is a string instead of one object in
ERP5
parent 645a4ece
......@@ -57,7 +57,10 @@ event = portal.restrictedTraverse(event_relative_url)\n
subject = event.getTitle()\n
body = event.getTextContent()\n
sender = event.getSourceValue()\n
if sender is not None:\n
if kw.get("from_url") is not None:\n
from_url = kw.get("from_url")\n
elif event.getSource() is not None:\n
sender = event.getSourceValue()\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
else:\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
......
1020
\ No newline at end of file
1021
\ No newline at end of file
......@@ -110,8 +110,15 @@ if portal_preferences.getPreferredCredentialAlarmAutomaticCall():\n
message_str = "Credential Request Created."\n
else:\n
if portal_preferences.isPreferredEmailVerificationCheck():\n
# Send email to subscriber in order to check email\'s address\n
credential_request.activate(activity=\'SQLQueue\').CredentialRequest_sendSubmittedNotification(\n
# after_path_and_method_id argument is used below to not activate when\n
# Crededial request object is not indexed yet. This is needed because when\n
# the method searchAndActivate from catalog is called, if the object is not\n
# indexed, the e-mail is not sent.\n
method_id_list = (\'immediateReindexObject\', \'recursiveImmediateReindexObject\')\n
path_and_method_id = (credential_request.getPath(), method_id_list)\n
activity_kw = dict(activity=\'SQLQueue\',\n
after_path_and_method_id=path_and_method_id)\n
credential_request.activate(**activity_kw).CredentialRequest_sendSubmittedNotification(\n
context_url=context.absolute_url(),\n
notification_reference=\'erp5-subscription.notification\')\n
message_str = "Thanks for your registration. You will be receive an email to activate your account."\n
......
412
\ No newline at end of file
413
\ No newline at end of file
......@@ -81,7 +81,6 @@ class TestERP5Credential(ERP5TypeTestCase):
system_preference = self.portal.portal_preferences.newContent(
portal_type='System Preference')
system_preference.enable()
system_preference.edit(preferred_event_sender_email=['Sample s@s.com',])
@reindex
def enableAlarm(self):
......
......@@ -511,7 +511,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
person = self.portal.person_module.newContent(
portal_type="Person",
default_email_text="userA@example.invalid")
self.stepTic()
self.portal.portal_notifications.sendMessage(
store_as_event=True,
recipient=person,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment