Commit 8ed6f61e authored by Yusei Tahara's avatar Yusei Tahara

Update updateCellList. Support simpler data structure to add cells.

parent 8cf0df19
......@@ -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,6 +576,11 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
result[argument_name] = item[index]
return result
data_list = []
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:
......@@ -580,7 +592,6 @@ def updateCellList(portal, line, cell_type, cell_range_method, cell_dict_list):
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])))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment