Commit cfc7ae3c authored by Jérome Perrin's avatar Jérome Perrin

Repair script to import Accounting Plan from CSV file, and move configurable

parts in the dialog.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14116 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 37473493
......@@ -86,7 +86,6 @@ def convertToUpperCase(key):\n
return result\n
\n
\n
\n
def splitCsvLine(str_line):\n
unclean_list = []\n
pieces_of_line = str_line.split(\',\')\n
......@@ -139,7 +138,6 @@ csv_title_list = splitCsvLine(csv_line_list[1])\n
for csv_line in csv_line_list[2:]:\n
object = {}\n
csv_data_list = splitCsvLine(csv_line)\n
\n
data_n = 0\n
\n
for property in csv_property_list:\n
......@@ -149,29 +147,24 @@ for csv_line in csv_line_list[2:]:\n
object_list.append(object)\n
\n
\n
\n
root_path = \'gap/france/m14\'\n
\n
for object in object_list: \n
description = object.get(\'Description\', None) or None\n
gap = object.get(\'Gap\', None) or None\n
title = object.get(\'Title\', None) or None\n
for object in object_list:\n
description = object.get(\'Description\', None) or \'\'\n
gap = object.get(\'Gap\', None) or \'\'\n
title = object.get(\'Title\', None) or \'\'\n
gap = str(gap)\n
if gap:\n
gap = gap.replace(\'CLASSE \', \'\')\n
print \'%s - %s - %s\' % (gap or \'\', title or \'\', description or \'\')\n
root = context.getPortalObject()\n
root = root.portal_categories.restrictedTraverse(root_path)\n
root = root.portal_categories.restrictedTraverse(gap_root_path)\n
b = \'\'\n
for a in gap:\n
b = b + a\n
if root.has_key(b):\n
root = root[b]\n
else: \n
else:\n
root = root.newContent(id=b)\n
root.edit(title = title or \'\', description = description or \'\')\n
\n
\n
#context.activate(priority=4).Base_importCsvLine(object)\n
root.edit(title=title, description=description)\n
\n
return printed\n
\n
......@@ -201,7 +194,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>import_file, encoding=\'iso-8859-15\', **kw</string> </value>
<value> <string>import_file, gap_root_path, encoding=\'iso-8859-15\', **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -221,13 +214,14 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>import_file</string>
<string>gap_root_path</string>
<string>encoding</string>
<string>kw</string>
<string>_print_</string>
......@@ -251,11 +245,11 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>data_n</string>
<string>property</string>
<string>_write_</string>
<string>root_path</string>
<string>None</string>
<string>description</string>
<string>gap</string>
<string>title</string>
<string>str</string>
<string>root</string>
<string>b</string>
<string>a</string>
......
......@@ -67,8 +67,7 @@
<key> <string>group_list</string> </key>
<value>
<list>
<string>Default</string>
<string>hidden</string>
<string>center</string>
</list>
</value>
</item>
......@@ -77,19 +76,15 @@
<value>
<dictionary>
<item>
<key> <string>Default</string> </key>
<key> <string>center</string> </key>
<value>
<list>
<string>my_import_file</string>
<string>your_gap_root_path</string>
<string>explanation</string>
<string>your_import_file</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>LabelField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>explanation</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>File must be a CSV file with a header line containing "Gap" and "Title" columns</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Explanation</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_import_file</string> </value>
<value> <string>your_import_file</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
253
\ No newline at end of file
254
\ No newline at end of file
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