import using csv file

Asked by Bushair

Hi,
I was trying to import some data using csv file to the OpenERP product form.

I have navigated to Products->FormProducts

Added the following fields in the fields to import section

Code
Name
Sale Price
Cost Price

the csv file contains the following data

Code,Name,Sale Price,Cost Price
"69","6680 ND NOKIA MOBILE",$900.00,"900.00","Mobile Phones"
"70","6020 IT-NOKIA MOBILE",$325.00,"335.00","Mobile Phones"
"72","6120-IT-NOKIA MOBILE",$1220.00,"1220.00","Mobile Phones"
"74","N73M WHITE MQ-NOKIA MOBILE",$1350.00,"1350.00","Mobile Phones"
"75","3100 MQ-NOKIA MOBILE",$370.00,"350.00","Mobile Phones"
"76","2600 MQ-NOKIA MOBILE",$225.00,"225.00","Mobile Phones"

But am getting below error when i press the import button

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/openerp-server/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.4/site-packages/openerp-server/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.4/site-packages/openerp-server/service/web_services.py", line 583, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line 118, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/osv.py", line 110, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/orm.py", line 805, in import_data
    (res, other, warning, translate, data_id, res_id) = \
  File "/usr/lib/python2.4/site-packages/openerp-server/osv/orm.py", line 699, in process_liness
    res = line[i] and float(line[i])
ValueError: invalid literal for float(): $900.00

How to resolve this error?

Thanks

Question information

Language:
English Edit question
Status:
Invalid
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Vinay Rana (OpenERP)
Solved:
Last query:
Last reply:
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#1

Hello Bushair,

You can not pass float field in '$900.00' manner.because now this data behaves like string not float.

Thanks.

Revision history for this message
Bushair (bushairka) said :
#2

Hi,
So if i modify the csv as shown below ,it should work..right?

Code,Name,Sale Price,Cost Price
"69","6680 ND NOKIA MOBILE",$900.00,900.00,"Mobile Phones"

Is this format is ok?

Thanks

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#3

Hello Bushair,

You can do like following manner:

default_code,name,list_price,standard_price

69,6680 ND NOKIA MOBILE,900.00,900.00
70,6020 IT-NOKIA MOBILE,325.00,335.00
72,6120-IT-NOKIA MOBILE,1220.00,1220.00
74,N73M WHITE MQ-NOKIA MOBILE,1350.00,1350.00
75,3100 MQ-NOKIA MOBILE,370.00,350.00
76,2600 MQ-NOKIA MOBILE,225.00,225.00

Thanks.

Revision history for this message
Bushair (bushairka) said :
#4

Hi,
Thanks alot for the information..

Can you please tell me where the default_code field is available to import?

Can you please Navigate to Products- >Products Form and then import

there is no default_code field available here.

From which page i can get defualt_code field?

thanks

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#5

Hello Bushair,

You just first try export the data from export wizard and import compatible field needs to be true in export wizard.
The generated wizard output csv will give you better idea regarding fields and format.

Thanks.

Revision history for this message
Bushair (bushairka) said :
#6

Hi,
I have tried to export the Code and Name field with the import compatible field true.
This generated a csv file with the defualt_code and name field.

But when i try to import using the below csv file ,

default_code,name

PC1,Basic PC

am getting the below error

Error processing your first line of the file.
Field default_code is unknown!

This error is coming when i select the file using Browse,

thanks

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#7