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
Aaron Chen
erp5
Commits
8ed6f61e
Commit
8ed6f61e
authored
Jun 23, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update updateCellList. Support simpler data structure to add cells.
parent
8cf0df19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
28 deletions
+39
-28
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+39
-28
No files found.
product/ERP5Type/tests/utils.py
View file @
8ed6f61e
...
...
@@ -475,6 +475,7 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
- cell_range_kw
- mapped_value_argument_list
- table
- variation_category_list_and_mapped_value_list (optional)
Example:
updateCellList(sale_order_line_1_1,
...
...
@@ -523,6 +524,12 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
)
)
Also you can pass variation_category_list_and_mapped_value_list. Then you do not
have touse above table structure. variation_category_list_and_mapped_value_list
structure should be like following:
((variation_category_list, mapped_value),
(variation_category_list, mapped_value),
(variation_category_list, mapped_value),)
"""
def
get_range_id_list
(
range_list
):
if
not
range_list
:
...
...
@@ -569,37 +576,41 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
result
[
argument_name
]
=
item
[
index
]
return
result
# verify table structure to know dimension.
table
=
cell_dict
[
'table'
]
if
len
([
True
for
item
in
table
if
len
(
item
)
!=
2
])
==
0
:
dimension
=
1
elif
len
(
table
)
>
1
and
(
len
(
table
[
0
])
+
1
)
==
len
(
table
[
1
]):
dimension
=
2
elif
isinstance
(
table
[
0
][
0
],
(
tuple
,
list
)):
dimension
=
3
else
:
raise
RuntimeError
,
"Unsupported table structure!"
data_list
=
[]
if
dimension
==
1
:
for
table_line
in
table
:
data_list
.
append
(([
table_line
[
0
]],
getMappedValueDict
(
table_line
[
1
])))
elif
dimension
==
2
:
column
=
table
[
0
]
for
table_line
in
table
[
1
:]:
row
=
table_line
[
0
]
for
index
,
item
in
enumerate
(
table_line
[
1
:]):
data_list
.
append
(([
row
,
column
[
index
]],
getMappedValueDict
(
item
)))
elif
dimension
==
3
:
table_list
=
table
for
table
in
table_list
:
tab_list
=
list
(
table
[
0
])
tab_list
.
reverse
()
column
=
table
[
1
]
for
table_line
in
table
[
2
:]:
if
cell_dict
.
get
(
'variation_category_list_and_mapped_value_list'
):
for
variation_category_list
,
mapped_value
in
cell_dict
.
get
(
'variation_category_list_and_mapped_value_list'
):
data_list
.
append
((
variation_category_list
,
getMappedValueDict
(
mapped_value
)))
else
:
# verify table structure to know dimension.
table
=
cell_dict
[
'table'
]
if
len
([
True
for
item
in
table
if
len
(
item
)
!=
2
])
==
0
:
dimension
=
1
elif
len
(
table
)
>
1
and
(
len
(
table
[
0
])
+
1
)
==
len
(
table
[
1
]):
dimension
=
2
elif
isinstance
(
table
[
0
][
0
],
(
tuple
,
list
)):
dimension
=
3
else
:
raise
RuntimeError
,
"Unsupported table structure!"
if
dimension
==
1
:
for
table_line
in
table
:
data_list
.
append
(([
table_line
[
0
]],
getMappedValueDict
(
table_line
[
1
])))
elif
dimension
==
2
:
column
=
table
[
0
]
for
table_line
in
table
[
1
:]:
row
=
table_line
[
0
]
for
index
,
item
in
enumerate
(
table_line
[
1
:]):
data_list
.
append
(([
row
,
column
[
index
]]
+
tab_list
,
getMappedValueDict
(
item
)))
data_list
.
append
(([
row
,
column
[
index
]],
getMappedValueDict
(
item
)))
elif
dimension
==
3
:
table_list
=
table
for
table
in
table_list
:
tab_list
=
list
(
table
[
0
])
tab_list
.
reverse
()
column
=
table
[
1
]
for
table_line
in
table
[
2
:]:
row
=
table_line
[
0
]
for
index
,
item
in
enumerate
(
table_line
[
1
:]):
data_list
.
append
(([
row
,
column
[
index
]]
+
tab_list
,
getMappedValueDict
(
item
)))
for
category_list
,
mapped_value_dict
in
data_list
:
category_list
=
getSortedCategoryList
(
line
,
base_id
,
category_list
)
...
...
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