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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
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):
...
@@ -475,6 +475,7 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
- cell_range_kw
- cell_range_kw
- mapped_value_argument_list
- mapped_value_argument_list
- table
- table
- variation_category_list_and_mapped_value_list (optional)
Example:
Example:
updateCellList(sale_order_line_1_1,
updateCellList(sale_order_line_1_1,
...
@@ -523,6 +524,12 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
...
@@ -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
):
def
get_range_id_list
(
range_list
):
if
not
range_list
:
if
not
range_list
:
...
@@ -569,37 +576,41 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
...
@@ -569,37 +576,41 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
result
[
argument_name
]
=
item
[
index
]
result
[
argument_name
]
=
item
[
index
]
return
result
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
=
[]
data_list
=
[]
if
dimension
==
1
:
if
cell_dict
.
get
(
'variation_category_list_and_mapped_value_list'
):
for
table_line
in
table
:
for
variation_category_list
,
mapped_value
in
cell_dict
.
get
(
'variation_category_list_and_mapped_value_list'
):
data_list
.
append
(([
table_line
[
0
]],
getMappedValueDict
(
table_line
[
1
])))
data_list
.
append
((
variation_category_list
,
getMappedValueDict
(
mapped_value
)))
elif
dimension
==
2
:
else
:
column
=
table
[
0
]
# verify table structure to know dimension.
for
table_line
in
table
[
1
:]:
table
=
cell_dict
[
'table'
]
row
=
table_line
[
0
]
if
len
([
True
for
item
in
table
if
len
(
item
)
!=
2
])
==
0
:
for
index
,
item
in
enumerate
(
table_line
[
1
:]):
dimension
=
1
data_list
.
append
(([
row
,
column
[
index
]],
getMappedValueDict
(
item
)))
elif
len
(
table
)
>
1
and
(
len
(
table
[
0
])
+
1
)
==
len
(
table
[
1
]):
elif
dimension
==
3
:
dimension
=
2
table_list
=
table
elif
isinstance
(
table
[
0
][
0
],
(
tuple
,
list
)):
for
table
in
table_list
:
dimension
=
3
tab_list
=
list
(
table
[
0
])
else
:
tab_list
.
reverse
()
raise
RuntimeError
,
"Unsupported table structure!"
column
=
table
[
1
]
for
table_line
in
table
[
2
:]:
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
]
row
=
table_line
[
0
]
for
index
,
item
in
enumerate
(
table_line
[
1
:]):
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
:
for
category_list
,
mapped_value_dict
in
data_list
:
category_list
=
getSortedCategoryList
(
line
,
base_id
,
category_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