Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Łukasz Nowak
erp5
Commits
1af22428
Commit
1af22428
authored
Mar 26, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master', remote-tracking branch 'origin' into rafael
parents
125c1c62
67bccd94
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
287 additions
and
155 deletions
+287
-155
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createMailMessageAsString.xml
...portal_skins/erp5_base/Base_createMailMessageAsString.xml
+94
-0
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml
...nTemplateItem/portal_skins/erp5_base/Entity_sendEmail.xml
+33
-12
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Event_send.xml
...se/SkinTemplateItem/portal_skins/erp5_base/Event_send.xml
+57
-60
bt5/erp5_base/bt/revision
bt5/erp5_base/bt/revision
+1
-1
bt5/erp5_rss_style/SkinTemplateItem/portal_skins/erp5_rss_style/Listbox_asRSS.xml
...emplateItem/portal_skins/erp5_rss_style/Listbox_asRSS.xml
+3
-1
bt5/erp5_rss_style/bt/revision
bt5/erp5_rss_style/bt/revision
+1
-1
bt5/erp5_simulation_performance_test/PathTemplateItem/business_process_module/test_bp.xml
...test/PathTemplateItem/business_process_module/test_bp.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_categories/base_amount/tax.xml
...st/PathTemplateItem/portal_categories/base_amount/tax.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_categories/quantity_unit/unit.xml
...PathTemplateItem/portal_categories/quantity_unit/unit.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_advanced_sale_invoice_builder.xml
.../portal_deliveries/test_advanced_sale_invoice_builder.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_advanced_sale_invoice_trade_model_builder.xml
...veries/test_advanced_sale_invoice_trade_model_builder.xml
+1
-6
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_sale_packing_list_builder.xml
...Item/portal_deliveries/test_sale_packing_list_builder.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_rules/test_trade_model_rule.xml
...t/PathTemplateItem/portal_rules/test_trade_model_rule.xml
+0
-4
bt5/erp5_simulation_performance_test/PathTemplateItem/sale_trade_condition_module/test_stc.xml
...PathTemplateItem/sale_trade_condition_module/test_stc.xml
+0
-4
bt5/erp5_simulation_performance_test/SkinTemplateItem/portal_skins/erp5_simulation_performance_test.xml
...ateItem/portal_skins/erp5_simulation_performance_test.xml
+1
-1
bt5/erp5_simulation_performance_test/bt/revision
bt5/erp5_simulation_performance_test/bt/revision
+1
-1
product/ERP5/tests/testCRM.py
product/ERP5/tests/testCRM.py
+57
-5
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+6
-0
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+6
-6
product/ERP5/tests/testTradeModelLine.py
product/ERP5/tests/testTradeModelLine.py
+13
-25
product/ERP5Legacy/Document/TradeModelRule.py
product/ERP5Legacy/Document/TradeModelRule.py
+2
-0
product/ERP5Legacy/tests/testLegacySimulationPerformance.py
product/ERP5Legacy/tests/testLegacySimulationPerformance.py
+7
-7
product/ERP5Legacy/tests/testLegacyTradeModelLine.py
product/ERP5Legacy/tests/testLegacyTradeModelLine.py
+3
-0
tests/__init__.py
tests/__init__.py
+1
-1
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_createMailMessageAsString.xml
0 → 100644
View file @
1af22428
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<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>
_body
</string>
</key>
<value>
<string>
if content_type == \'text/html\':\n
mail_template = context.Event_viewHtmlMimeMessage\n
else:\n
mail_template = context.Event_viewMimeMessage\n
\n
for embedded_file in embedded_file_list:\n
mime_type, content = embedded_file.getMimeTypeAndContent()\n
name = embedded_file.getFilename()\n
\n
attachment_list.append({\'mime_type\':mime_type,\n
\'content\':content,\n
\'name\':name})\n
\n
# Allow to embed image in HTML by setting the relative URL of the image with FCKeditor\n
attachment_url = embedded_file.getRelativeUrl()\n
body = body.replace(\'src="%s"\' % attachment_url, \'src="cid:%s"\' % \'\'.join([\'%s\' % ord(i) for i in name]))\n
\n
multipart = mail_template.as_message(mfrom=from_url,\n
mto=to_url,\n
subject=subject,\n
body=body,\n
encoding=\'utf-8\')\n
for attachment_dict in attachment_list:\n
multipart.add_file(data=attachment_dict[\'content\'],\n
content_type=attachment_dict[\'mime_type\'],\n
filename=attachment_dict[\'name\'])\n
\n
return str(multipart)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
from_url, to_url, subject, body, content_type, attachment_list=[], embedded_file_list=[]
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_createMailMessageAsString
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ba
nking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Person_init
.xml
→
bt5/erp5_ba
se/SkinTemplateItem/portal_skins/erp5_base/Entity_sendEmail
.xml
View file @
1af22428
...
...
@@ -50,24 +50,45 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
user_site_list = context.Baobab_getUserAssignedSiteList()\n
if len(user_site_list)>
0:\n
site = context.Baobab_getVaultSite(user_site_list[0])\n
site_url = site.getRelativeUrl()\n
context.setSite(site_url)\n
]]>
</string>
</value>
<value>
<string>
from email.utils import formataddr\n
portal = context.getPortalObject()\n
event = portal.restrictedTraverse(event_relative_url)\n
\n
subject = event.getTitle()\n
body = event.getTextContent()\n
sender = event.getSourceValue()\n
if sender is not None:\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
else:\n
from_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
\n
to_url = formataddr((context.getTitle(), context.getDefaultEmailText()))\n
\n
document_type_list = list(event.getPortalEmbeddedDocumentTypeList()) + list(event.getPortalDocumentTypeList())\n
embedded_file_list = event.getAggregateValueList(portal_type=document_type_list)\n
\n
content_type = event.getContentType()\n
mail_message = context.Base_createMailMessageAsString(from_url,\n
to_url,\n
subject,\n
body,\n
content_type,\n
attachment_list=[],\n
embedded_file_list=embedded_file_list)\n
\n
event.sendMailHostMessage(mail_message)\n
\n
if not event.hasData():\n
event.setData(mail_message)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
event_relative_url,
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_init
</string>
</value>
<value>
<string>
Entity_sendEmail
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Event_send.xml
View file @
1af22428
...
...
@@ -51,79 +51,76 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from email.utils import formataddr\n
from email import message_from_string\n
portal = context.getPortalObject()\n
\n
if body is None:\n
body = context.getTextContent() #XXX This does not support structured text format.\n
\n
# Subject\n
if subject is None:\n
subject = context.getTitle()\n
use_activity = False\n
mail_message = None\n
to_url_list = []\n
\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
if not context.isTempDocument() and to_url is None:\n
use_activity = True\n
\n
# Return-Path\n
if reply_url is None:\n
reply_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
additional_headers = None\n
if reply_url:\n
additional_headers = {\'Return-Path\':reply_url}\n
\n
# To (multiple)\n
to_url_list = []\n
to_email_list = []\n
if to_url is None:\n
if use_activity:\n
recipient = context.getDestinationValue()\n
to_url_list.append(formataddr((recipient.getTitle(), recipient.getDefaultEmailText())))\n
else:\n
to_email_list = []\n
for recipient in context.getDestinationValueList():\n
email = recipient.getDefaultEmailText()\n
if email:\n
if email not in to_email_list:\n
to_email_list.append(email)\n
to_url_list.append(formataddr((recipient.getTitle(),
email
)))\n
to_url_list.append(formataddr((recipient.getTitle(),
recipient.getDefaultEmailText()
)))\n
else:\n
raise ValueError, \'Recipient %s has no defined email\' % recipient
\n
el
if same_type(to_url, \'\')
:\n
raise ValueError("One email must be set to %s" % person.getRelativeUrl())
\n
el
se
:\n
to_url_list.append(to_url)\n
\n
# Attachments\n
if attachment_list is None:\n
attachment_list = []\n
document_type_list = list(context.getPortalEmbeddedDocumentTypeList()) + list(context.getPortalDocumentTypeList())\n
for attachment in context.getAggregateValueList(portal_type=document_type_list):\n
mime_type, content = attachment.getMimeTypeAndContent()\n
name = attachment.getFilename()\n
if download or not use_activity:\n
for to_url in to_url_list:\n
body = body or context.getTextContent()\n
subject = subject or context.getTitle()\n
\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
\n
# Return-Path\n
if reply_url is None:\n
reply_url = portal.portal_preferences.getPreferredEventSenderEmail()\n
additional_headers = None\n
if reply_url:\n
additional_headers = {\'Return-Path\':reply_url}\n
\n
attachment_list.append({\'mime_type\':mime_type,\n
\'content\':content,\n
\'name\':name})\n
# Attachments\n
if attachment_list is None:\n
attachment_list = []\n
document_type_list = list(context.getPortalEmbeddedDocumentTypeList()) + list(context.getPortalDocumentTypeList())\n
embedded_file_list = context.getAggregateValueList(portal_type=document_type_list)\n
\n
# Allow to embed image in HTML by setting the relative URL of the image with FCKeditor\n
attachment_url = attachment.getRelativeUrl()\n
body = body.replace(\'src="%s"\' % attachment_url, \'src="cid:%s"\' % \'\'.join([\'%s\' % ord(i) for i in name]))\n
content_type = context.getContentType()\n
\n
# Build message per destination\n
mail_message = None\n
if context.getContentType() == \'text/html\':\n
mail_template = context.Event_viewHtmlMimeMessage\n
else:\n
mail_template = context.Event_viewMimeMessage\n
mail_message = context.Base_createMailMessageAsString(from_url, \n
to_url,\n
subject,\n
body,\n
content_type,\n
attachment_list=attachment_list,\n
embedded_file_list=embedded_file_list)\n
\n
for to_url in to_url_list:\n
multipart = mail_template.as_message(mfrom=from_url,\n
mto=to_url,\n
subject=subject,\n
body=body,\n
encoding=\'utf-8\')\n
for attachment_dict in attachment_list:\n
multipart.add_file(data=attachment_dict[\'content\'],\n
content_type=attachment_dict[\'mime_type\'],\n
filename=attachment_dict[\'name\'])\n
mail_message = str(multipart)\n
context.edit(data=mail_message)\n
if not use_activity:\n
context.activate(activity=\'SQLQueue\').sendMailHostMessage(mail_message)\n
\n
context.setData(mail_message)\n
if use_activity:\n
uid_list = context.getDestinationUidList()\n
method_kw = dict(event_relative_url=context.getRelativeUrl(),\n
from_url=from_url)\n
portal.portal_catalog.searchAndActivate(method_id="Entity_sendEmail",\n
uid=uid_list,\n
method_kw=method_kw, **kw)\n
\n
# Transit event workflow\n
if context.getTypeInfo() is not None:\n
...
...
bt5/erp5_base/bt/revision
View file @
1af22428
1009
\ No newline at end of file
1015
\ No newline at end of file
bt5/erp5_rss_style/SkinTemplateItem/portal_skins/erp5_rss_style/Listbox_asRSS.xml
View file @
1af22428
...
...
@@ -94,7 +94,7 @@ feed_data = {}\n
request = context.REQUEST\n
\n
# required channel elements for RSS 2.0 specification\n
required_field_list = (\'title\', \'description\', \'link\'
,
)\n
required_field_list = (\'title\', \'description\', \'link\')\n
\n
# required + optional channel elements\n
allowed_field_list = (\'title\', \'description\', \'link\', \'author\', \n
...
...
@@ -103,6 +103,7 @@ allowed_field_list = (\'title\', \'description\', \'link\', \'author\', \n
\n
# figure out which column is which, by using column titles\n
rss_column_mapping = {}\n
\n
for index, column_item in enumerate(label_list):\n
column_header = column_item[1]\n
if column_header.lower() in allowed_field_list:\n
...
...
@@ -155,6 +156,7 @@ for line in line_list:\n
items.append(rss_item_string)\n
\n
feed_data[\'listItemInfos\'] = tuple(items)\n
\n
return feed_data\n
...
...
bt5/erp5_rss_style/bt/revision
View file @
1af22428
52
\ No newline at end of file
55
\ No newline at end of file
bt5/erp5_simulation_performance_test/PathTemplateItem/business_process_module/test_bp.xml
View file @
1af22428
...
...
@@ -104,10 +104,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_bp
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
9
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Business Process
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_categories/base_amount/tax.xml
View file @
1af22428
...
...
@@ -101,10 +101,6 @@
<key>
<string>
int_index
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
2
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Category
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_categories/quantity_unit/unit.xml
View file @
1af22428
...
...
@@ -93,10 +93,6 @@
<key>
<string>
int_index
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
1
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Category
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_advanced_sale_invoice_builder.xml
View file @
1af22428
...
...
@@ -73,10 +73,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_advanced_sale_invoice_builder
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
1
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Delivery Builder
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_advanced_sale_invoice_trade_model_builder.xml
View file @
1af22428
...
...
@@ -44,8 +44,7 @@
<key>
<string>
delivery_cell_separate_order
</string>
</key>
<value>
<tuple>
<string>
calculateAveragePrice
</string>
<string>
calculateAddQuantity
</string>
<string>
calculateSeparatePrice
</string>
</tuple>
</value>
</item>
...
...
@@ -75,10 +74,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_advanced_sale_invoice_trade_model_builder
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
2
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Delivery Builder
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_deliveries/test_sale_packing_list_builder.xml
View file @
1af22428
...
...
@@ -73,10 +73,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_sale_packing_list_builder
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
1
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Delivery Builder
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/portal_rules/test_trade_model_rule.xml
View file @
1af22428
...
...
@@ -153,10 +153,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_trade_model_rule
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
3
</string>
</value>
</item>
<item>
<key>
<string>
matching_property
</string>
</key>
<value>
...
...
bt5/erp5_simulation_performance_test/PathTemplateItem/sale_trade_condition_module/test_stc.xml
View file @
1af22428
...
...
@@ -123,10 +123,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
test_stc
</string>
</value>
</item>
<item>
<key>
<string>
last_id
</string>
</key>
<value>
<string>
2
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Sale Trade Condition
</string>
</value>
...
...
bt5/erp5_simulation_performance_test/SkinTemplateItem/portal_skins/erp5_simulation_performance_test.xml
View file @
1af22428
...
...
@@ -31,7 +31,7 @@
</item>
<item>
<key>
<string>
business_template_skin_layer_priority
</string>
</key>
<value>
<float>
1
0.0
</float>
</value>
<value>
<float>
4
0.0
</float>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_simulation_performance_test/bt/revision
View file @
1af22428
22
\ No newline at end of file
23
\ No newline at end of file
product/ERP5/tests/testCRM.py
View file @
1af22428
...
...
@@ -42,6 +42,7 @@ from email.mime.multipart import MIMEMultipart
from
email.mime.base
import
MIMEBase
from
email.mime.text
import
MIMEText
from
email
import
encoders
,
message_from_string
from
DateTime
import
DateTime
def
makeFilePath
(
name
):
return
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'crm_emails'
,
name
)
...
...
@@ -73,7 +74,6 @@ class BaseTestCRM(ERP5TypeTestCase):
for
module_name
in
clear_module_name_list
:
module
=
self
.
portal
.
unrestrictedTraverse
(
module_name
)
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
self
.
stepTic
()
super
(
BaseTestCRM
,
self
).
beforeTearDown
()
...
...
@@ -82,7 +82,10 @@ class TestCRM(BaseTestCRM):
return
"CRM"
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,
return
(
'erp5_full_text_myisam_catalog'
,
'erp5_core_proxy_field_legacy'
,
'erp5_base'
,
'erp5_ingestion'
,
'erp5_crm'
,)
def
test_Event_CreateRelatedEvent
(
self
):
...
...
@@ -450,7 +453,9 @@ class TestCRMMailIngestion(BaseTestCRM):
def
getBusinessTemplateList
(
self
):
# Mail Ingestion must work with CRM alone.
return
(
'erp5_base'
,
return
(
'erp5_core_proxy_field_legacy'
,
'erp5_full_text_myisam_catalog'
,
'erp5_base'
,
'erp5_ingestion'
,
'erp5_ingestion_mysql_innodb_catalog'
,
'erp5_crm'
,
...
...
@@ -846,7 +851,6 @@ class TestCRMMailSend(BaseTestCRM):
def
afterSetUp
(
self
):
super
(
TestCRMMailSend
,
self
).
afterSetUp
()
portal
=
self
.
portal
# create customer organisation and person
portal
.
organisation_module
.
newContent
(
id
=
'customer'
,
...
...
@@ -1189,7 +1193,6 @@ class TestCRMMailSend(BaseTestCRM):
text_content
=
'This is an advertisement mail.'
)
mail_text
=
event
.
send
(
download
=
True
)
# Check mail text.
message
=
message_from_string
(
mail_text
)
part
=
None
...
...
@@ -1673,6 +1676,55 @@ class TestCRMMailSend(BaseTestCRM):
transaction
.
commit
()
self
.
tic
()
def
test_MailMessage_Event_send_generate_activity_list
(
self
):
"""
Check that after post a Mail Message, the activities are generated
correctly
"""
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
person
.
edit
(
default_email_text
=
"test@test.com"
,
title
=
"test%s"
%
person
.
getId
())
self
.
stepTic
()
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Mail Message"
)
relative_url_list
=
[
z
.
getRelativeUrl
()
for
z
in
self
.
portal
.
person_module
.
searchFolder
()]
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
.
stepTic
()
mail_message
.
Event_send
(
packet_size
=
2
)
import
transaction
transaction
.
commit
()
portal_activities
=
self
.
portal
.
portal_activities
message_list
=
[
i
for
i
in
portal_activities
.
getMessageList
()
\
if
i
.
kw
.
has_key
(
"event_relative_url"
)]
try
:
self
.
assertEquals
(
2
,
len
(
message_list
))
finally
:
self
.
stepTic
()
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
())
def
test_MailMessage_Event_send_simple_case
(
self
):
"""
Check that the script Event_send send one email passing all parameters directly
from_url, to_url, reply_url, subject, body, attachment_format, attachment_list
"""
mail_message
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Mail Message"
)
self
.
stepTic
()
mail_message
.
Event_send
(
from_url
=
'FG ER <eee@eee.com>'
,
to_url
=
'Expert User <expert@in24.test>'
,
subject
=
"Simple Case"
,
body
=
"Body Simple Case"
,
attachment_list
=
[])
self
.
stepTic
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
[
-
1
]
self
.
assertTrue
(
"Body Simple Case"
in
last_message
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestCRM
))
...
...
product/ERP5/tests/testERP5Credential.py
View file @
1af22428
...
...
@@ -76,6 +76,12 @@ class TestERP5Credential(ERP5TypeTestCase):
if
'MailHost'
in
self
.
portal
.
objectIds
():
self
.
portal
.
manage_delObjects
([
'MailHost'
])
self
.
portal
.
_setObject
(
'MailHost'
,
DummyMailHost
(
'MailHost'
))
system_preference
=
self
.
getPreferenceTool
().
getActiveSystemPreference
()
if
system_preference
is
None
:
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
):
...
...
product/ERP5/tests/testERP5Web.py
View file @
1af22428
...
...
@@ -1484,7 +1484,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_03_WebSection_getDocumentValueListSecurity
(
self
):
""" Test WebSection_getDocumentValueList behaviour and security"""
self
.
login
(
'admin'
)
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
site
.
publish
()
...
...
@@ -1620,7 +1620,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_04_ExpireUserAction
(
self
):
""" Test the expire user action"""
self
.
login
(
'admin'
)
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
# create websections in a site and in anothers web sections
section_1
=
site
.
newContent
(
portal_type
=
'Web Section'
,
id
=
'section_1'
)
...
...
@@ -1650,7 +1650,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_05_createWebSite
(
self
):
""" Test to create or clone web sites with many users """
self
.
login
(
'admin'
)
web_site_module
=
self
.
web_site_module
web_site_module
=
self
.
portal
.
web_site_module
# test for admin
try
:
...
...
@@ -1673,7 +1673,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_06_createWebSection
(
self
):
""" Test to create or clone web sections with many users """
self
.
login
(
'admin'
)
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
# test for admin
try
:
...
...
@@ -1818,7 +1818,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
project
.
validate
()
self
.
stepTic
()
website
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
website
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
website
.
publish
()
website
.
setMembershipCriterionBaseCategory
(
'follow_up'
)
...
...
@@ -1856,7 +1856,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
Test that by default Anonymous User cannot access Web Site Module
"""
self
.
logout
()
self
.
assertRaises
(
Unauthorized
,
self
.
web_site_module
.
view
)
self
.
assertRaises
(
Unauthorized
,
self
.
portal
.
web_site_module
.
view
)
class
TestERP5WebCategoryPublicationWorkflow
(
ERP5TypeTestCase
):
...
...
product/ERP5/tests/testTradeModelLine.py
View file @
1af22428
...
...
@@ -344,7 +344,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
packing_list
.
stop
()
transaction
.
commit
()
self
.
tic
()
self
.
stepInvoiceBuilderAlarm
()
self
.
buildInvoices
()
transaction
.
commit
()
self
.
tic
()
...
...
@@ -478,21 +478,15 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self
.
assertEquals
(
str
(
abs
(
line_dict
[
'income_expense'
])),
str
(
rounded_total_price
+
rounded_discount_price
))
def
stepPackingListBuilderAlarm
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# global builder alarm does not exist in legacy simulation
# business templates.
alarm
=
getattr
(
self
.
portal
.
portal_alarms
,
'packing_list_builder_alarm'
,
None
)
if
alarm
is
not
None
:
alarm
.
activeSense
()
def
stepInvoiceBuilderAlarm
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# global builder alarm does not exist in legacy simulation
# business templates.
alarm
=
getattr
(
self
.
portal
.
portal_alarms
,
'invoice_builder_alarm'
,
None
)
if
alarm
is
not
None
:
alarm
.
activeSense
()
def
buildPackingLists
(
self
):
self
.
portal
.
portal_alarms
.
packing_list_builder_alarm
.
activeSense
()
transaction
.
commit
()
self
.
tic
()
def
buildInvoices
(
self
):
self
.
portal
.
portal_alarms
.
invoice_builder_alarm
.
activeSense
()
transaction
.
commit
()
self
.
tic
()
###
## Test cases
...
...
@@ -606,9 +600,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
order
.
confirm
()
transaction
.
commit
()
self
.
tic
()
self
.
stepPackingListBuilderAlarm
()
transaction
.
commit
()
self
.
tic
()
self
.
buildPackingLists
()
packing_list
,
=
order
.
getCausalityRelatedValueList
(
portal_type
=
self
.
packing_list_portal_type
)
...
...
@@ -937,9 +929,7 @@ return lambda *args, **kw: 1""")
order
.
confirm
()
transaction
.
commit
()
self
.
tic
()
self
.
stepPackingListBuilderAlarm
()
transaction
.
commit
()
self
.
tic
()
self
.
buildPackingLists
()
packing_list
=
order
.
getCausalityRelatedValue
(
portal_type
=
self
.
packing_list_portal_type
)
...
...
@@ -951,9 +941,7 @@ return lambda *args, **kw: 1""")
packing_list
.
deliver
()
transaction
.
commit
()
self
.
tic
()
self
.
stepInvoiceBuilderAlarm
()
transaction
.
commit
()
self
.
tic
()
self
.
buildInvoices
()
invoice
=
packing_list
.
getCausalityRelatedValue
(
portal_type
=
self
.
invoice_portal_type
)
...
...
product/ERP5Legacy/Document/TradeModelRule.py
View file @
1af22428
...
...
@@ -70,6 +70,8 @@ class TradeModelRule(Rule):
context_movement
=
applied_rule
.
getParentValue
()
for
amount
in
trade_condition
.
getAggregatedAmountList
(
context_movement
):
if
not
amount
.
getQuantity
():
continue
# business path specific
business_path_list
=
business_process
.
getPathValueList
(
trade_phase
=
amount
.
getTradePhaseList
(),
context
=
context_movement
)
...
...
product/ERP5
/tests/test
SimulationPerformance.py
→
product/ERP5
Legacy/tests/testLegacy
SimulationPerformance.py
View file @
1af22428
...
...
@@ -121,13 +121,10 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
"""
Return the list of business templates.
"""
return
(
'erp5_base'
,
'erp5_pdm'
,
'erp5_trade'
,
'erp5_invoicing'
,
'erp5_accounting'
,
'erp5_advanced_invoicing'
,
'erp5_simulation_performance_test'
,)
return
(
'erp5_core_proxy_field_legacy'
,
'erp5_base'
,
'erp5_pdm'
,
'erp5_simulation'
,
'erp5_trade'
,
'erp5_accounting'
,
'erp5_invoicing'
,
'erp5_advanced_invoicing'
,
'erp5_simulation_test'
,
'erp5_simulation_performance_test'
)
def
afterSetUp
(
self
):
"""
...
...
@@ -794,6 +791,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
number_of_additional_sale_packing_list_lines
=
5
,
measurable
=
True
)
from
Products.ERP5Legacy.tests
import
Legacy_getBusinessTemplateList
Legacy_getBusinessTemplateList
(
TestSimulationPerformance
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestSimulationPerformance
))
...
...
product/ERP5Legacy/tests/testLegacyTradeModelLine.py
View file @
1af22428
...
...
@@ -52,6 +52,9 @@ for name in list(TestTradeModelLine.__dict__):
if
'_NewSimulation_'
in
name
:
delattr
(
TestTradeModelLine
,
name
)
TestTradeModelLine
.
buildInvoices
=
TestTradeModelLine
.
buildPackingLists
=
\
lambda
self
:
None
def
createBusinessProcess
(
self
,
*
args
,
**
kw
):
business_process
=
super
(
TestTradeModelLine
,
self
)
\
.
createBusinessProcess
(
*
args
,
**
kw
)
...
...
tests/__init__.py
View file @
1af22428
...
...
@@ -57,7 +57,7 @@ class ERP5(_ERP5):
# skip some tests
if
test_case
.
startswith
(
'testLive'
)
or
test_case
.
startswith
(
'testVifib'
)
\
or
test_case
.
startswith
(
'testFunctional'
)
\
or
test_case
in
(
'testPerformance'
,
'testSimulationPerformance'
,
or
test_case
in
(
'testPerformance'
,
'test
Legacy
SimulationPerformance'
,
'testERP5LdapCatalog'
,
# XXX (Ivan), until LDAP server is available this test will alway fail
'testERP5eGov'
,
# it is not maintained any more
'testAccounting_l10n_fr_m9'
):
...
...
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