[Erp5-dev] Proposal for CSV import/export enhancements
Jérome Perrin
jerome at nexedi.com
Wed Oct 17 15:46:20 CEST 2007
Jérome Perrin a écrit :
> Łukasz Nowak a écrit :
>> Hello,
>>
>> While playing with production we are able to import BOMs and many
>> other useful information from various CAD/CAM/etc programs using CSV.
>>
>> As CSV is quite...hm...undefined, there are many problems. Many
>> programs use different implementation of CSV - some of them use ";" as
>> separator some ",". Some use '"' as quote mark, some "'". Some use
>> UTF-8 encoding, some other ASCII, and so on. So, IMHO, importing of
>> CSV might be two-phase system. First one upload file, second one
>> choose some attributes and provide user special listbox, which will
>> "simulate" how will system understand provided CSV. Something similar
>> to OpenOffice CSV import/export dialog.
>
> Hi,
>
> As you pointed out, despite looking simple, csv is in reality extremly
> complex (you can look at python csv module implementation), that's one
> more reason why we concentrate on importing from OpenOffice. It still
> needs improvement, but here's what we have today:
>
> - Import of categories from a spreadsheet (Import/Export action from
> portal_categories). This uses oood to convert this input file, if for
> instance you upload a .xls file. I haven't try with CSV, I don't know if
> oood can convert from CSV.
I can give more precise information: This is done in
CategoryTool_importCategoryFile script from erp5_core business template.
If the user provides a file which is not in open office format, it
creates a newTempOOoDocument and call convert('sxc') which uses oood to
get the file content converted in sxc format.
> - There is an interesting prototype on person module: "Import Persons
> from OpenOffice Calc".
> This tool propose to map openoffice column to document properties.
This action is also an object_exchange action on Person Module portal
type. The script is ERP5Site_importObjectFromOOo from erp5_base. With
this tool, you update the spreadsheet once, then the dialog contains a
listbox where you see your spreadsheet columns, and you can choose which
document properties to use for which spreadsheet column.
Once you specified this in the listbox, you upload spreadsheet again and
it will create objects, one per line in your spreadsheet, and edit
objects according to what you defined in the listbox.
Jérome
More information about the Erp5-dev
mailing list