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
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
Frederic Thoma
erp5
Commits
86ef0f8d
Commit
86ef0f8d
authored
Nov 13, 2018
by
Aurel
Browse files
Options
Browse Files
Download
Plain Diff
DeferredStyle : allow to send an email containing links to reports instead of the report itself
/reviewed-on
nexedi/erp5!799
parents
9e152672
e1a14da7
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1183 additions
and
17 deletions
+1183
-17
bt5/erp5_deferred_style/ActionTemplateItem/portal_types/System%20Preference/deferred_preference.xml
.../portal_types/System%20Preference/deferred_preference.xml
+81
-0
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference.xml
...teItem/portal_property_sheets/DeferredStylePreference.xml
+66
-0
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_classification_property.xml
...nce/preferred_deferred_report_classification_property.xml
+44
-0
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_notification_message_reference_property.xml
...ferred_report_notification_message_reference_property.xml
+38
-0
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_publication_section_property.xml
...referred_deferred_report_publication_section_property.xml
+44
-0
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_stored_as_document_property.xml
...preferred_deferred_report_stored_as_document_property.xml
+44
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.py
...l_skins/erp5_deferred_style_core/Base_renderSimpleView.py
+6
-1
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.py
...Item/portal_skins/erp5_deferred_style_core/Base_report.py
+7
-3
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_notifyReportComplete.py
...erp5_deferred_style_core/ERP5Site_notifyReportComplete.py
+61
-9
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_notifyReportComplete.xml
...rp5_deferred_style_core/ERP5Site_notifyReportComplete.xml
+9
-1
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_viewReportCompleteNotificationMessage.xml
...e_core/ERP5Site_viewReportCompleteNotificationMessage.xml
+58
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_viewReportCompleteNotificationMessage.zpt
...e_core/ERP5Site_viewReportCompleteNotificationMessage.zpt
+17
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle.xml
...eferred_style_core/SystemPreference_viewDeferredStyle.xml
+134
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_classification.xml
...rredStyle/my_preferred_deferred_report_classification.xml
+126
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_notification_message_reference.xml
...ferred_deferred_report_notification_message_reference.xml
+89
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_publication_section.xml
...tyle/my_preferred_deferred_report_publication_section.xml
+126
-0
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_stored_as_document.xml
...Style/my_preferred_deferred_report_stored_as_document.xml
+84
-0
bt5/erp5_deferred_style/bt/template_action_path_list
bt5/erp5_deferred_style/bt/template_action_path_list
+1
-0
bt5/erp5_deferred_style/bt/template_property_sheet_id_list
bt5/erp5_deferred_style/bt/template_property_sheet_id_list
+1
-0
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+147
-3
No files found.
bt5/erp5_deferred_style/ActionTemplateItem/portal_types/System%20Preference/deferred_preference.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
deferred_preference
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
8.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Deferred Style
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/SystemPreference_viewDeferredStyle
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
DeferredStylePreference
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_classification_property.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_deferred_report_classification_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_notification_message_reference_property.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_deferred_report_notification_message_reference_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_publication_section_property.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_deferred_report_publication_section_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/PropertySheetTemplateItem/portal_property_sheets/DeferredStylePreference/preferred_deferred_report_stored_as_document_property.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/boolean
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
preferred_deferred_report_stored_as_document_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
preference
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.py
View file @
86ef0f8d
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
portal
.
REQUEST
request
=
portal
.
REQUEST
report_format
=
request_form
.
get
(
'format'
,
''
)
if
portal
.
portal_preferences
.
getPreferredDeferredReportStoredAsDocument
():
request_form
[
'format'
]
=
None
request
.
form
.
update
(
request_form
)
request
.
form
.
update
(
request_form
)
if
skin_name
and
skin_name
!=
'None'
:
# make_query serializes None as 'None'
if
skin_name
and
skin_name
!=
'None'
:
# make_query serializes None as 'None'
...
@@ -31,4 +35,5 @@ with portal.Localizer.translationContext(localizer_language):
...
@@ -31,4 +35,5 @@ with portal.Localizer.translationContext(localizer_language):
user_name
=
user_name
,
user_name
=
user_name
,
subject
=
str
(
translateString
(
attachment_name
.
rsplit
(
'.'
,
1
)[
0
])),
subject
=
str
(
translateString
(
attachment_name
.
rsplit
(
'.'
,
1
)[
0
])),
message
=
''
,
message
=
''
,
attachment_list
=
attachment_list
)
attachment_list
=
attachment_list
,
format
=
report_format
)
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_report.py
View file @
86ef0f8d
...
@@ -23,9 +23,12 @@ with portal.Localizer.translationContext(localizer_language):
...
@@ -23,9 +23,12 @@ with portal.Localizer.translationContext(localizer_language):
return
data
.
decode
(
'bz2'
)
return
data
.
decode
(
'bz2'
)
except
IOError
:
except
IOError
:
return
data
.
decode
(
'zlib'
)
return
data
.
decode
(
'zlib'
)
if
portal
.
portal_preferences
.
getPreferredDeferredReportStoredAsDocument
():
pt_render_format
=
None
else
:
pt_render_format
=
format
report_data
=
context
.
restrictedTraverse
(
form_path
).
report_view
.
pt_render
(
report_data
=
context
.
restrictedTraverse
(
form_path
).
report_view
.
pt_render
(
extra_context
=
dict
(
options
=
{
'format'
:
format
},
extra_context
=
dict
(
options
=
{
'format'
:
pt_render_
format
},
rendered_report_item_list
=
(
decodeReportSection
(
r
[
1
])
for
r
in
report_section_list
),
rendered_report_item_list
=
(
decodeReportSection
(
r
[
1
])
for
r
in
report_section_list
),
report_method
=
dummyReportMethod
,
report_method
=
dummyReportMethod
,
form
=
portal
.
restrictedTraverse
(
form_path
)))
form
=
portal
.
restrictedTraverse
(
form_path
)))
...
@@ -52,4 +55,5 @@ portal.ERP5Site_notifyReportComplete(
...
@@ -52,4 +55,5 @@ portal.ERP5Site_notifyReportComplete(
user_name
=
user_name
,
user_name
=
user_name
,
subject
=
title
,
subject
=
title
,
message
=
''
,
message
=
''
,
attachment_list
=
attachment_list
)
attachment_list
=
attachment_list
,
format
=
format
)
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_notifyReportComplete.py
View file @
86ef0f8d
from
Products.PythonScripts.standard
import
newline_to_br
,
html_quote
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
prefs
=
portal
.
portal_preferences
report_item_list
=
[]
message_text_format
=
"text/plain"
pre_convert_tag
=
'pre-convert-report-%s'
%
random
.
randint
(
0
,
1000
)
portal
.
portal_notifications
.
activate
(
activity
=
'SQLQueue'
).
sendMessage
(
if
prefs
.
getPreferredDeferredReportStoredAsDocument
():
recipient
=
user_name
,
for
attachment
in
attachment_list
:
subject
=
subject
,
document
=
portal
.
portal_contributions
.
newContent
(
message
=
message
,
data
=
attachment
[
'content'
],
message_text_format
=
'text/plain'
,
publication_section
=
prefs
.
getPreferredDeferredReportPublicationSection
(),
notifier_list
=
(
'Mail Message'
,),
classification
=
prefs
.
getPreferredDeferredReportClassification
(),
store_as_event
=
False
,
filename
=
attachment
[
'name'
],
attachment_list
=
attachment_list
,
)
)
document
.
share
()
report_item_list
.
append
(
(
attachment
.
get
(
'title'
,
document
.
getStandardFilename
(
format
=
format
)),
document
.
getRelativeUrl
()))
# pre-convert document before sending notification
if
format
:
document
.
activate
(
tag
=
pre_convert_tag
).
convert
(
format
=
format
)
url_base
=
portal
.
ERP5Site_getAbsoluteUrl
()
attachment_link_list
=
[
{
'download_link'
:
'%s/%s?format=%s'
%
(
url_base
,
report_url
,
format
),
'name'
:
report_name
}
for
(
report_name
,
report_url
)
in
report_item_list
]
message_html
=
newline_to_br
(
html_quote
(
message
))
message_text_format
=
"text/html"
attachment_list
=
[]
notification_message_reference
=
prefs
.
getPreferredDeferredReportNotificationMessageReference
()
if
notification_message_reference
:
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
reference
=
notification_message_reference
)
if
notification_message
is
None
:
raise
ValueError
(
'Notification message not found by %r'
%
prefs
.
getPreferredDeferredReportNotificationMessageReference
())
notification_mapping_dict
=
{
'report_link_list'
:
portal
.
ERP5Site_viewReportCompleteNotificationMessage
(
attachment_link_list
=
attachment_link_list
),
'message'
:
message_html
}
message
=
notification_message
.
asEntireHTML
(
safe_substitute
=
False
,
substitution_method_parameter_dict
=
{
'mapping_dict'
:
notification_mapping_dict
})
else
:
# fallback to generating message with the page template when no notification message
message
=
portal
.
ERP5Site_viewReportCompleteNotificationMessage
(
attachment_link_list
=
attachment_link_list
,
message
=
message_html
)
portal
.
portal_notifications
.
activate
(
after_tag
=
pre_convert_tag
,
activity
=
'SQLQueue'
).
sendMessage
(
recipient
=
user_name
,
subject
=
subject
,
message
=
message
,
message_text_format
=
message_text_format
,
notifier_list
=
(
'Mail Message'
,),
store_as_event
=
False
,
attachment_list
=
attachment_list
,
)
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_notifyReportComplete.xml
View file @
86ef0f8d
...
@@ -50,7 +50,15 @@
...
@@ -50,7 +50,15 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
user_name, subject, message, attachment_list
</string>
</value>
<value>
<string>
user_name, subject, message, attachment_list, format=""
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_viewReportCompleteNotificationMessage.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<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_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_viewReportCompleteNotificationMessage
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/ERP5Site_viewReportCompleteNotificationMessage.zpt
0 → 100644
View file @
86ef0f8d
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal">
<tal:block tal:replace="nothing">
This page template is used to prepare `report_link_list` variable to pass to notification message.
When no notification message exists, this page template acts as a "default notification message" and
receive `message` argument.
</tal:block>
<tal:block tal:condition="options/message | nothing">
<p>
<tal:block tal:replace="structure options/message" />
</p>
</tal:block>
<tal:block tal:repeat="attachment options/attachment_link_list">
<p>
<a tal:attributes="href attachment/download_link" tal:content="attachment/name"></a>
</p>
</tal:block>
</tal:block>
\ No newline at end of file
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5 Form"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string>
multipart/form-data
</string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_preferred_deferred_report_stored_as_document
</string>
<string>
my_preferred_deferred_report_notification_message_reference
</string>
<string>
my_preferred_deferred_report_classification
</string>
<string>
my_preferred_deferred_report_publication_section
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SystemPreference_viewDeferredStyle
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
SystemPreference_viewDeferredStyle
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Deferred Style
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_classification.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
items
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_deferred_report_classification
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_category
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Preferred Classification
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.portal_categories.classification.getCategoryChildLogicalPathItemList(display_none_category=1,filter_node=1,local_sort_id=\'title\',checked_permission=\'View\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_notification_message_reference.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
display_width
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_deferred_report_notification_message_reference
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewWizardFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Notification Message Reference
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_publication_section.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
items
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_deferred_report_publication_section
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_category
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Preferred Publication Section
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.portal_categories.publication_section.getCategoryChildLogicalPathItemList(display_none_category=1,filter_node=1,local_sort_id=\'title\',checked_permission=\'View\')
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/SystemPreference_viewDeferredStyle/my_preferred_deferred_report_stored_as_document.xml
0 → 100644
View file @
86ef0f8d
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_preferred_deferred_report_stored_as_document
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_checkbox
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Deferred Report Stored as Document
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_deferred_style/bt/template_action_path_list
0 → 100644
View file @
86ef0f8d
System Preference | deferred_preference
\ No newline at end of file
bt5/erp5_deferred_style/bt/template_property_sheet_id_list
0 → 100644
View file @
86ef0f8d
DeferredStylePreference
\ No newline at end of file
product/ERP5OOo/tests/testDeferredStyle.py
View file @
86ef0f8d
...
@@ -28,10 +28,12 @@
...
@@ -28,10 +28,12 @@
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5OOo.tests.utils
import
Validator
from
Products.ERP5OOo.tests.utils
import
Validator
import
email
from
lxml
import
html
import
email
,
urlparse
,
httplib
class
TestDeferredStyle
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
class
TestDeferredStyle
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
...
@@ -45,6 +47,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -45,6 +47,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
# address. Zope 2.12 only surrounds names with quotes if they really need
# address. Zope 2.12 only surrounds names with quotes if they really need
# quoting.
# quoting.
first_name
=
'Bob<Par'
first_name
=
'Bob<Par'
publication_section
=
"reporting"
classification
=
"collaborative"
def
getTitle
(
self
):
def
getTitle
(
self
):
return
'Test Deferred Style'
return
'Test Deferred Style'
...
@@ -54,6 +58,10 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -54,6 +58,10 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
'erp5_base'
,
'erp5_base'
,
'erp5_ods_style'
,
'erp5_ods_style'
,
'erp5_odt_style'
,
'erp5_odt_style'
,
'erp5_ingestion_mysql_innodb_catalog'
,
'erp5_ingestion'
,
'erp5_web'
,
'erp5_dms'
,
'erp5_deferred_style'
,
'erp5_deferred_style'
,
'erp5_l10n_fr'
,)
'erp5_l10n_fr'
,)
...
@@ -76,6 +84,25 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -76,6 +84,25 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
password
=
self
.
password
,
password
=
self
.
password
,
)
)
login
.
validate
()
login
.
validate
()
system_preference
=
self
.
portal
.
portal_preferences
.
_getOb
(
'syspref'
,
None
)
if
system_preference
is
None
:
system_preference
=
self
.
portal
.
portal_preferences
.
newContent
(
id
=
"syspref"
,
portal_type
=
"System Preference"
)
system_preference
.
enable
()
# Fallback to former behaviour
system_preference
.
edit
(
preferred_deferred_report_stored_as_document
=
False
)
# add categories
if
not
getattr
(
self
.
portal
.
portal_categories
.
classification
,
'collaborative'
,
None
):
self
.
portal
.
portal_categories
.
classification
.
newContent
(
id
=
"collaborative"
)
if
not
getattr
(
self
.
portal
.
portal_categories
.
publication_section
,
'reporting'
,
None
):
self
.
portal
.
portal_categories
.
publication_section
.
newContent
(
id
=
"reporting"
)
self
.
tic
()
def
beforeTearDown
(
self
):
document_ids
=
list
(
self
.
portal
.
document_module
.
objectIds
())
if
len
(
document_ids
):
self
.
portal
.
document_module
.
manage_delObjects
(
ids
=
document_ids
)
self
.
tic
()
self
.
tic
()
def
loginAsUser
(
self
,
username
):
def
loginAsUser
(
self
,
username
):
...
@@ -117,6 +144,123 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -117,6 +144,123 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
else
:
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
def
_checkEmailLink
(
self
,
part
,
extension
=
None
,
content_type
=
None
):
content
=
part
.
get_payload
(
decode
=
True
)
self
.
assertTrue
(
"History%s"
%
extension
or
self
.
attachment_file_extension
in
content
)
tree
=
html
.
fromstring
(
content
)
link
,
=
[
href
for
href
in
tree
.
xpath
(
'//a/@href'
)
if
href
]
relative_url
=
urlparse
.
urlparse
(
link
)
report
=
self
.
publish
(
relative_url
.
path
+
"?"
+
relative_url
.
query
,
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
assertEqual
(
httplib
.
OK
,
report
.
getStatus
())
self
.
assertEqual
(
report
.
getHeader
(
'content-type'
),
content_type
or
self
.
content_type
)
def
_checkDocument
(
self
):
document_list
=
self
.
portal
.
document_module
.
objectValues
()
self
.
assertEquals
(
len
(
document_list
),
1
)
document
=
document_list
[
0
].
getObject
()
expected_file_name
=
'History%s'
%
self
.
attachment_file_extension
self
.
assertEqual
(
expected_file_name
,
document
.
getFilename
())
self
.
assertEqual
(
'History'
,
document
.
getTitle
())
self
.
assertEqual
(
None
,
document
.
getReference
())
self
.
assertEqual
(
"shared"
,
document
.
getValidationState
())
self
.
assertEqual
(
self
.
publication_section
,
document
.
getPublicationSection
())
self
.
assertEqual
(
self
.
classification
,
document
.
getClassification
())
self
.
assertEqual
(
self
.
portal_type
,
document
.
getPortalType
())
def
_defineSystemPreference
(
self
,
notification_message_reference
=
None
):
system_preference
=
self
.
portal
.
portal_preferences
.
_getOb
(
'syspref'
,
None
)
system_preference
.
edit
(
preferred_deferred_report_stored_as_document
=
True
,
preferred_deferred_report_classification
=
self
.
classification
,
preferred_deferred_report_publication_section
=
self
.
publication_section
,
preferred_deferred_report_notification_message_reference
=
notification_message_reference
)
def
test_report_stored_as_document
(
self
):
self
.
_defineSystemPreference
()
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
self
.
_checkDocument
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
message_text
=
last_message
self
.
assertEqual
(
'"%s" <%s>'
%
(
self
.
first_name
,
self
.
recipient_email_address
),
mto
[
0
])
mail_message
=
email
.
message_from_string
(
message_text
)
for
part
in
mail_message
.
walk
():
content_type
=
part
.
get_content_type
()
if
content_type
==
"text/html"
:
self
.
_checkEmailLink
(
part
)
break
else
:
self
.
fail
(
'Link not found in email
\
n
%s'
%
message_text
)
def
test_report_stored_as_document_with_notification_message
(
self
):
createZODBPythonScript
(
self
.
portal
,
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
'mapping_dict'
,
'''return mapping_dict'''
)
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
reference
=
"notification-deferred.report"
,
content_type
=
"text/html"
,
text_content
=
'Hi,
\
n
\
n
Here is the link(s) to your report(s) : ${report_link_list}.
\
n
\
n
'
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromArgument'
,
)
notification_message
.
newContent
(
portal_type
=
"Role Definition"
,
role_name
=
"Auditor"
,
agent
=
"person_module/pers"
)
notification_message
.
validate
()
self
.
tic
()
self
.
_defineSystemPreference
(
"notification-deferred.report"
)
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
self
.
_checkDocument
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
message_text
=
last_message
self
.
assertEqual
(
'"%s" <%s>'
%
(
self
.
first_name
,
self
.
recipient_email_address
),
mto
[
0
])
mail_message
=
email
.
message_from_string
(
message_text
)
for
part
in
mail_message
.
walk
():
content_type
=
part
.
get_content_type
()
if
content_type
==
"text/html"
:
self
.
_checkEmailLink
(
part
)
break
else
:
self
.
fail
(
'Link not found in email
\
n
%s'
%
message_text
)
def
test_pdf_report_stored_as_document
(
self
):
self
.
_defineSystemPreference
()
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s&format=pdf'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
# A document has been created
self
.
_checkDocument
()
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEquals
((),
last_message
)
mfrom
,
mto
,
message_text
=
last_message
self
.
assertEqual
(
'"%s" <%s>'
%
(
self
.
first_name
,
self
.
recipient_email_address
),
mto
[
0
])
mail_message
=
email
.
message_from_string
(
message_text
)
for
part
in
mail_message
.
walk
():
content_type
=
part
.
get_content_type
()
if
content_type
==
"text/html"
:
self
.
_checkEmailLink
(
part
,
".pdf"
,
"application/pdf"
)
break
else
:
self
.
fail
(
'Link not found in email
\
n
%s'
%
message_text
)
def
test_normal_form
(
self
):
def
test_normal_form
(
self
):
self
.
loginAsUser
(
'bob'
)
self
.
loginAsUser
(
'bob'
)
# simulate a big request, for which Base_callDialogMethod will not issue a
# simulate a big request, for which Base_callDialogMethod will not issue a
...
@@ -213,6 +357,7 @@ class TestODSDeferredStyle(TestDeferredStyle):
...
@@ -213,6 +357,7 @@ class TestODSDeferredStyle(TestDeferredStyle):
skin
=
'ODS'
skin
=
'ODS'
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
attachment_file_extension
=
'.ods'
attachment_file_extension
=
'.ods'
portal_type
=
"Spreadsheet"
def
test_report_view_sheet_per_report_section
(
self
):
def
test_report_view_sheet_per_report_section
(
self
):
"""Test the sheet_per_report_section feature of erp5_ods_style.
"""Test the sheet_per_report_section feature of erp5_ods_style.
...
@@ -251,11 +396,10 @@ class TestODTDeferredStyle(TestDeferredStyle):
...
@@ -251,11 +396,10 @@ class TestODTDeferredStyle(TestDeferredStyle):
skin
=
'ODT'
skin
=
'ODT'
content_type
=
'application/vnd.oasis.opendocument.text'
content_type
=
'application/vnd.oasis.opendocument.text'
attachment_file_extension
=
'.odt'
attachment_file_extension
=
'.odt'
portal_type
=
"Text"
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODSDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyle
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestODTDeferredStyle
))
return
suite
return
suite
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