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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
erp5
Commits
a38e2907
Commit
a38e2907
authored
Feb 10, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ods_style: make `sheet_per_report_section` compatible with deferred style
parent
4d5be6da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
4 deletions
+49
-4
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.oot
...nTemplateItem/portal_skins/erp5_ods_style/report_view.oot
+17
-4
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+32
-0
No files found.
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/report_view.oot
View file @
a38e2907
...
...
@@ -92,14 +92,27 @@
</table:table>
</tal:block>
<tal:block tal:condition="sheet_per_report_section">
<tal:block tal:repeat="report_item python: report_item_list">
<tal:block tal:condition="python: report_item.getFormId()">
<table:table tal:attributes="table:name python: unicode(report_item.getTitle() or 'Sheet%s' % repeat['report_item'].index, 'utf-8')">
<tal:block tal:condition="rendered_report_item_list">
<tal:block tal:repeat="report_item report_item_list">
<!-- FIXME: in deferred mode + sheet_per_report_section we do not have title -->
<table:table tal:attributes="table:name python: unicode('Sheet%s' % repeat['report_item'].index, 'utf-8')">
<table:table-column table:style-name="co4" table:default-cell-style-name="text"/>
<tal:block
metal:use-macro="here/report_view/macros/make_report_item_table
"/>
<tal:block
tal:replace="structure report_item
"/>
</table:table>
</tal:block>
</tal:block>
<tal:block tal:condition="not: rendered_report_item_list">
<tal:block tal:repeat="report_item python: report_item_list">
<tal:block tal:condition="python: report_item.getFormId()">
<table:table tal:attributes="table:name python: unicode(report_item.getTitle() or 'Sheet%s' % repeat['report_item'].index, 'utf-8')">
<table:table-column table:style-name="co4" table:default-cell-style-name="text"/>
<tal:block metal:use-macro="here/report_view/macros/make_report_item_table"/>
</table:table>
</tal:block>
</tal:block>
</tal:block>
<!-- include the report header as last page -->
<table:table tal:attributes="table:name python:unicode(form.getProperty('title'), 'utf8')" i18n:attributes="table:name">
<table:table-column
...
...
product/ERP5OOo/tests/testDeferredStyle.py
View file @
a38e2907
...
...
@@ -149,6 +149,38 @@ class TestODSDeferredStyle(TestDeferredStyle):
content_type
=
'application/vnd.oasis.opendocument.spreadsheet'
attachment_file_extension
=
'.ods'
def
test_report_view_sheet_per_report_section
(
self
):
"""Test the sheet_per_report_section feature of erp5_ods_style.
"""
self
.
loginAsUser
(
'bob'
)
self
.
portal
.
changeSkin
(
'Deferred'
)
response
=
self
.
publish
(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s&sheet_per_report_section:int=1'
%
(
self
.
portal
.
getId
(),
self
.
skin
),
'%s:%s'
%
(
self
.
username
,
self
.
password
))
self
.
tic
()
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
()
file_name
=
part
.
get_filename
()
if
content_type
==
self
.
content_type
:
# "History" is the title of Base_viewHistory form
file_name
=
part
.
get_filename
()
expected_file_name
=
'History%s'
%
self
.
attachment_file_extension
self
.
assertEqual
(
expected_file_name
,
file_name
)
self
.
assertEqual
(
'attachment; filename="%s"'
%
expected_file_name
,
part
.
get
(
'Content-Disposition'
))
data
=
part
.
get_payload
(
decode
=
True
)
error_list
=
Validator
().
validate
(
data
)
if
error_list
:
self
.
fail
(
''
.
join
(
error_list
))
break
else
:
self
.
fail
(
'Attachment not found in email
\
n
%s'
%
message_text
)
class
TestODTDeferredStyle
(
TestDeferredStyle
):
skin
=
'ODT'
...
...
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