Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

TypeError: string indices must be integers, not str

By
kristian
on 12/4/13, 1:16 AM 3,271 views

I'm using the prestashop - openerp connector module, but when i try to import data from the website (background jobs) is giving me this error traceback:

 File "/usr/prestaconnect/openerp-connector/connector/queue/worker.py", line 122, in run_job
 job.perform(session)
 File "/usr/prestaconnect/openerp-connector/connector/queue/job.py", line 460, in perform
self.result = self.func(session, *self.args, **self.kwargs)
 File "/usr/prestaconnect/prestashoperpconnect/prestashoperpconnect/unit/import_synchronizer.py", line 663, in       import_batch
  importer.run(filters=filters, **kwargs)
 File "/usr/prestaconnect/prestashoperpconnect/prestashoperpconnect/unit/import_synchronizer.py", line 202, in run
return super(PaymentMethodsImportSynchronizer, self).run(filters, **kwargs)
 File "/usr/prestaconnect/prestashoperpconnect/prestashoperpconnect/unit/import_synchronizer.py", line 176, in run
record_ids = self._run_page(filters)
 File "/usr/prestaconnect/prestashoperpconnect/prestashoperpconnect/unit/import_synchronizer.py", line 186, in _run_page
self._import_record(record_id, **kwargs)
 File "/usr/prestaconnect/prestashoperpconnect/prestashoperpconnect/unit/import_synchronizer.py", line 206, in _import_record
 ('name', '=', record['payment']),
 TypeError: string indices must be integers, not str

In the module code i see this:

class PaymentMethodsImportSynchronizer(BatchImportSynchronizer):
_model_name = 'payment.method'

 def run(self, filters=None, **kwargs):
   if filters is None:
    filters = {}
filters['display'] = '[id,payment]'
   return super(PaymentMethodsImportSynchronizer, self).run(filters, **kwargs)

  def _import_record(self, record):
   ids = self.session.search('payment.method', [
    ('name', '=', record['payment']),
    ('company_id', '=', self.backend_record.company_id.id),
    ])
    if ids:
        return
    self.session.create('payment.method', {
    'name': record['payment'],
    'company_id': self.backend_record.company_id.id,
   })

I don't know what actually is happening, i need some lights on this, cause i did not developed this module, and i'm new to prestashop - openerp integration.

I managed to install everything and it does import metadata and base data as well.

Any help would be greatly appreciated, thanks in advance!

1
Benoit COVILLE
On 12/15/13, 11:24 AM

Hi,

Same error for me.

It appears since they added code in revision 281 on the 2013-11-14 to import payment methods.

You can browse the change in the code here : bazaar.launchpad.net/~prestashoperpconnect-core-editors/prestashoperpconnect/7.0/revision/281 and comment all the changes.

Regards

Oh, thank you very much! Just saw your answer! I'll check it out, merci!

kristian
on 1/19/14, 4:31 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/4/13, 1:16 AM
Seen: 3271 times
Last updated: 3/16/15, 8:10 AM