This question has been flagged
3 Replies
10133 Views

I am trying to import a set of lead data via the CSV import. I created a dummy lead and exported it to confirm the format and mandatory columns. As far as I can see I have everything matching (clearly something is wrong though). I have also tried various tweaks to the CSV file including controlling the encoding format and quoting all fields. The result is the same every time - "need more than 1 value to unpack".
The format and sample data are:


"contact_name","title","Function","email_from","partner_name","Street","city","Zip","phone","FAX","ref2","ref","Subject" "Michael Smith","Mr","Accounts Manager","m.smith@tbps.co.uk","The Big Partnership","Ground Floor, Big Towers Court Main Street","Anytown","AT41 1AT","01234563000","01234564000","www.thebigpartnership.co.uk",70,"Professional Services"


The error block from the logs is given below:


Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/addons/base_import/models.py", line 320, in do cr, uid, import_fields, data, context=context) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 1379, in load noupdate=noupdate, res_id=id, context=context)) File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_model.py", line 967, in _update res_id = model_obj.create(cr, uid, values, context=context) File "/usr/lib/pymodules/python2.7/openerp/addons/crm/crm_lead.py", line 99, in create return super(crm_lead, self).create(cr, uid, vals, context=create_context) File "/usr/lib/pymodules/python2.7/openerp/addons/mail/mail_thread.py", line 241, in create thread_id = super(mail_thread, self).create(cr, uid, values, context=context) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4452, in create self._check_selection_field_value(cr, user, field, vals[field], context=context) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2817, in _check_selection_field_value val_model, val_id_str = value.split(',', 1) ValueError: need more than 1 value to unpack


I may be staring at something obvious, but I can't see why I'm getting this error. Can anybody provide any clues, please?

Avatar
Discard
Author

@Ray Carnes. Thank for a very clear answer.  That helped tremendously.

Best Answer

"_check_selection_field_value" indicates that a selection field was unable to be parsed.

The only selection field (appears with a dropdown of values to select on the UI) you are using is Title.

Mr is not a valid value for this field.  It is expecting an External ID which contains a and that's why the parser can't split that field.  

Valid values for that field include:

  • base.res_partner_title_doctor
  • base.res_partner_title_madam
  • base.res_partner_title_miss
  • base.res_partner_title_mister
  • base.res_partner_title_prof
  • base.res_partner_title_sir

Note the period between the word base and the rest of the ID.

 

 

Avatar
Discard
Author Best Answer
Avatar
Discard
Best Answer

Hi, The reason you are gettting this error is because some values are missing on the csv file you are trying to upload. Example look at the ir.property model or you can access this directly from the settings>parameters>configuration parameters. Click and open one of the records. You will see that there are input fields that go in-hand i.e should be updated together. Look at the fields under label Resources. You can activate the developer mode to have a clear view on these fields. So to fix your error, make sure that you have captured all fields on your csv before trying to upload.  ( need more than 1 value to unpack) > means that an item is missing and it's needed for successful upload of your data. Hope this helps you.

Avatar
Discard