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
Carlos Ramos Carreño
erp5
Commits
914d58f5
Commit
914d58f5
authored
Aug 01, 2018
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix export of categories
parent
fcaa4499
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_constructCategoryTableToExport.py
.../erp5_core/CategoryTool_constructCategoryTableToExport.py
+1
-1
product/ERP5/tests/testERP5Core.py
product/ERP5/tests/testERP5Core.py
+23
-5
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_constructCategoryTableToExport.py
View file @
914d58f5
...
...
@@ -15,7 +15,7 @@ for base_cat_id in context.REQUEST['category_list']:
for
cat
in
context
.
portal_catalog
(
portal_type
=
'Category'
,
sort_on
=
((
'path'
,
'ascending'
),),
# This sorting is not enough.
limit
=
None
,
**
{
'default_%s_uid'
%
(
base_cat
.
getId
(),):
base_cat
.
getUid
()}
):
relative_url
=
"%s/%%"
%
base_cat
.
getRelativeUrl
()
):
cat_relative_url_path_list
=
cat
.
getRelativeUrl
().
split
(
'/'
)
cat_depth
=
len
(
cat_relative_url_path_list
)
temporary_category_list
.
append
((
cat_relative_url_path_list
,
cat
))
...
...
product/ERP5/tests/testERP5Core.py
View file @
914d58f5
...
...
@@ -664,8 +664,26 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
response
.
getStatus
(),
401
)
self
.
assertNotIn
(
"Also, the following error occurred"
,
str
(
response
))
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Core
))
return
suite
def
testCategoryExport
(
self
):
"""
Check we can export categories in a spreadsheet
"""
portal
=
self
.
getPortalObject
()
category_tool
=
portal
.
portal_categories
base_category_id
=
"test_category_export"
if
getattr
(
category_tool
,
base_category_id
,
None
)
is
not
None
:
category_tool
.
manage_delObjects
(
ids
=
[
base_category_id
])
base_category
=
category_tool
.
newContent
(
portal_type
=
"Base Category"
,
id
=
base_category_id
)
base_category
.
newContent
(
portal_type
=
"Category"
,
reference
=
"Rfoo"
,
id
=
"foo"
,
codification
=
"CFoo"
,
title
=
"Foo"
)
base_category
.
newContent
(
portal_type
=
"Category"
,
short_title
=
"SBar"
,
id
=
"bar"
,
int_index
=
3
,
description
=
"desc"
,
title
=
"Bar"
)
self
.
tic
()
self
.
portal
.
REQUEST
.
set
(
"format"
,
"csv"
)
self
.
portal
.
REQUEST
.
set
(
"category_list"
,
[
base_category_id
])
csv_data
=
category_tool
.
CategoryTool_exportCategory
()
self
.
assertEqual
(
"""Path,Id,Title,Short Title,Reference,Codification,Int Index,Description
*,bar,Bar,SBar,,,3,desc
*,foo,Foo,,Rfoo,CFoo,,
"""
,
csv_data
)
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