failed when export stock quantity

Bug #1255956 reported by zrxbos
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Prestashop OpenERP Connector
New
Undecided
Unassigned

Bug Description

when i update all the products stock quantities, i got HTTP 404 Not Found.

here is the traceback

Traceback (most recent call last):
  File "/home/voxteneo/prestashoperpconnect/openerp-connector/connector/queue/worker.py", line 122, in run_job
    job.perform(session)
  File "/home/voxteneo/prestashoperpconnect/openerp-connector/connector/queue/job.py", line 460, in perform
    self.result = self.func(session, *self.args, **self.kwargs)
  File "/home/voxteneo/prestashoperpconnect/prestashoperpconnect/prestashoperpconnect/product.py", line 479, in export_inventory
    return inventory_exporter.run(record_id, fields)
  File "/home/voxteneo/prestashoperpconnect/prestashoperpconnect/prestashoperpconnect/product.py", line 451, in run
    self.backend_adapter.update_inventory(prestashop_id, attributes)
  File "/home/voxteneo/prestashoperpconnect/prestashoperpconnect/prestashoperpconnect/product.py", line 420, in update_inventory
    return api.edit('stock_availables', attributes)
  File "/home/voxteneo/venv-openerp/src/prestapyt/prestapyt/prestapyt.py", line 417, in edit
    return self.edit_with_url(full_url, content)
  File "/home/voxteneo/venv-openerp/src/prestapyt/prestapyt/prestapyt.py", line 610, in edit_with_url
    return super(PrestaShopWebServiceDict, self).edit_with_url(url, xml_content)
  File "/home/voxteneo/venv-openerp/src/prestapyt/prestapyt/prestapyt.py", line 428, in edit_with_url
    r = self._execute(unicode_encode.encode(url), 'PUT', data=unicode_encode.encode(content), add_headers=headers)
  File "/home/voxteneo/venv-openerp/src/prestapyt/prestapyt/prestapyt.py", line 206, in _execute
    self._check_status_code(r.status_code, r.content)
  File "/home/voxteneo/venv-openerp/src/prestapyt/prestapyt/prestapyt.py", line 146, in _check_status_code
    status_code, ps_error_msg, ps_error_code)
PrestaShopWebServiceError: 'Invalid ID'

Here is the PUT message the connector send:
<?xml version="1.0" ?>
 <prestashop>
  <stock_available>
   <id_shop>1</id_shop>
   <id_product_attribute>0</id_product_attribute>
   <id_product>1</id_product>
   <quantity>100</quantity>
   <depends_on_stock>0</depends_on_stock>
   <id>{&quot;id_product_attribute&quot;: 0, &quot;id_product&quot;: 1}</id>
   <out_of_stock>1</out_of_stock>
  </stock_available>
 </prestashop>

Here is the respond i got:
<prestashop>
<errors>
 <error>
 <code>
 <![CDATA[92]]>
 </code>
 <message>
 <![CDATA[Invalid ID]]>
 </message>
 </error>
</errors>
</prestashop>

I expect that the problem come from the ID entity "<id>{&quot;id_product_attribute&quot;: 0, &quot;id_product&quot;: 1}</id>", because when i send same XML and just change the ID to become <id>1</id>, the quantity is updates successfully.

Tags: export
zrxbos (ricky-hariady)
description: updated
Revision history for this message
Mathieu Stumpf (0s) wrote :

Could you please give the procedure you used to retrieve messages that the connector sent and received?

tags: added: export
Revision history for this message
TuanNguyen (tuan-5) wrote :

You should change as below:

return api.edit(self._prestashop_model, {
            self._export_node_name: attributes
        }, '')

because edit() function of prestapyt is required input 3 parameter

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.