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.

0

Why am I getting a "list indices must be integers, not str" error while creating an order line via the XML-RPC?

By
P
on 3/23/14, 2:13 PM 1,786 views

I'm trying to create an order via XML-RPC using the OpenERP Online. All the referenced objects (products, customers and an empty order) are created fine. I get an error "list indices must be integers, not str" while creating the order line. Here are the (pretty-printed) request and response:

Request:

<?xml version="1.0" encoding="UTF-8"?>
<methodCall xmlns:ex="....">
<methodName>execute</methodName>
<params>
  <param><value>t123</value></param>
  <param><value><i4>1</i4></value></param>
  <param><value>adminpassword</value></param>
  <param><value>sale.order.line</value></param>
  <param><value>create</value></param>
  <param>
    <value>
      <struct>
        <member><name>product_uos_qty</name><value>1</value></member>
        <member><name>name</name><value>Order line name</value></member>
        <member><name>order_id</name><value>9</value></member>
        <member><name>product_uos</name><value>false</value></member>
        <member><name>price_unit</name><value>550.0</value></member>
        <member><name>th_weight</name><value>0</value></member>
        <member><name>product_uom_qty</name><value>1</value></member>
        <member><name>product_id</name><value>797</value></member>
        <member><name>discount</name><value>0</value></member>
        <member><name>product_uom</name><value>13</value></member>
      </struct>
    </value>
  </param>
</params>
</methodCall>

Response:

<?xml version="1.0"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value>
            <string>list indices must be integers, not str</string>
          </value>
        </member>
        <member>
          <name>faultString</name>
          <value>
            <string>
Traceback (most recent call last):  
File "/home/odoo/src/server/saas-3/openerp/service/wsgi_server.py", line 75, in xmlrpc_return    result = openerp.netsvc.dispatch_rpc(service, method, params)  
File "/home/odoo/src/server/saas-3/openerp/netsvc.py", line 240, in dispatch_rpc    result = dispatch(method, params)  
File "/home/odoo/src/server/saas-3/openerp/service/model.py", line 37, in dispatch    res = fn(db, uid, *params)  
File "/home/odoo/src/server/saas-3/openerp/service/model.py", line 113, in wrapper    return f(dbname, *args, **kwargs)  
File "/home/odoo/src/server/saas-3/openerp/service/model.py", line 181, in execute    res = execute_cr(cr, uid, obj, method, *args, **kw)  
File "/home/odoo/src/addons/saas-3/audittrail/audittrail.py", line 526, in execute_cr    return fct_src(cr, uid, model, method, *args, **kw)  
File "/home/odoo/src/server/saas-3/openerp/service/model.py", line 159, in execute_cr    return getattr(object, method)(cr, uid, *args, **kw)  
File "/home/odoo/src/addons/saas-3/sale/sale.py", line 844, in create    defaults = self.product_id_change(cr, uid, [], order['pricelist_id'][0], values['product_id'],TypeError: list indices must be integers, not str
            </string>
          </value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>

What is the cause of this problem?

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: 3/23/14, 2:13 PM
Seen: 1786 times
Last updated: 3/16/15, 8:10 AM