import product quantity from magento (stock)

Asked by Juhász Miklós

I managed to import from magento to OERP everiything through the 6 steps, except the products quantity. In the imported products the "real stock/virtual stock" is 0,00. Besides i did not find any function in the Product OpenER model, which should be responsible for stock level imoprt/export at all. Obviously it is not a bug, because i did not find other questions regarding this, I simply miss something. How should I import the stock from magento?


Question information

English Edit question
Magento OpenERP Connector Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
ntrubert-cobweb (ntrubert) said :


For now, I think stock level is not managed form magento to operp but is handled from openerp to magento.

I think that today we are only able to export stock level by Magento-Connection -> Magento Shops interface.

Revision history for this message
Juhász Miklós (mindegy) said :

Thank you for your answer! This one way stock level update sounds a little bit odd to me. For example we create a product in OERP, its stock level is 15. After exporting it to magento, someone from the internet buys one of them, the magento stock level is now 14. How should I know that, if i can not import magento stock levels back to OERP? In OERP the stock level infinitely stays 15. We have to keep track of stock changes in both magento (buying from webshop) and OERP (filling up stock if all of the products are sold) to have the real stock level. I simply can not immagine how can an ecommerce-ERP system work without two way stock synchronization.

Revision history for this message
Best ntrubert-cobweb (ntrubert) said :

In our case :
Openerp stock value is the reference. We export the value into Magento and Magento will decrease this value according to new order internally.
By the time if some body generate an internal Openerp order we do not want to use Magento stock value.
Of course Magento and Openerp is desynchronized until the following automatic synchronization from openerp to magento, but openerp will also decrease stock value when we import orders from magento.

Revision history for this message
Juhász Miklós (mindegy) said :

Thank You very much! This approach makes sense, and solves the problem entirely. Now i only have to put the initial stock values into OERP database, as we have an existing stock, whith way too much products to enter them manually, so I guess it is time for postgreSQL

Revision history for this message
Diogo Velho (diogovelho) said :


I can´t sync the stock in openerp V6 and Magento 1.5.

Al the others syncs are correct.

I Have instaled the demo data in magento and then sync with open erp.

I have a virtual stock of 250 and a real stock of 125 in openerp product HTC Touch diamond

I tried to sync and I get

NFO:!!!STOCK LEVEL!!!:!!!CREATING exportable_product_ids
INFO:!!!SHOP_ID!!!:!!!shop_id 2
INFO:!!!WEBSITE_ID!!!:!!!website_id {'shop_group_id': (1, u'Main Website'), 'id': 2}
INFO:!!!RES!!!:!!!RES {2: []}

I tried to apply this patch
and all the products whent to stock 0 in magento (expected) But the HTC diamond remained untouched.

Can someone help me please?


Revision history for this message
Diogo Velho (diogovelho) said :

Found solution:

Click in "export product" button at right in the product view page (select a product). After that al sync went well.

Do it foreach product

Revision history for this message
El Hadji Dem ( (eh-dem) said :

Hello , I got this error message when I try to export product from OpenErp 6.1 :

Traceback (most recent call last):
  File "/opt/openerp/openerp-6.1-1/openerp/osv/", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/osv/", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/openerp-6.1-1/openerp/osv/", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_sale_export_product/wizard/", line 77, in export_product
    return self.export(cr, uid, id, ['export_product'], context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_sale_export_product/wizard/", line 73, in export
    self._export_one_product(cr, uid, external_session, product_id, options, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/product_links_sync/", line 128, in _export_one_product
    res = super(product_export_wizard, self)._export_one_product(cr, uid, external_session, product_id, options, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_sale_export_product/wizard/", line 40, in _export_one_product
    product_obj._export_one_resource(cr, uid, external_session, product_id, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/", line 1129, in _export_one_resource
    False, mapping, mapping_id, defaults=defaults, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/", line 49, in wrapped
    return func(self, cr, uid, argument, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/", line 110, in wrapper
    return func(self, cr, uid, external_session, resource, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/", line 47, in _transform_and_send_one_resource
    return self.mag_transform_and_send_one_resource(cr, uid, external_session, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/", line 1110, in _transform_and_send_one_resource
    return self.send_to_external(cr, uid, external_session, {resource_id : resource}, mapping, mapping_id, update_date, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/", line 1067, in send_to_external
    self.export_inventory(cr, uid, external_session, product_ids, context=context)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/", line 1436, in export_inventory
    self._export_inventory(cr, uid, external_session, product_id, context=location_ctx)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/", line 110, in wrapper
    return func(self, cr, uid, external_session, resource, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/", line 1452, in _export_inventory
    [mag_product_id, inventory_vals])
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/", line 223, in call
    res =, method, arguments)
  File "/usr/lib/python2.7/", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/", line 1578, in __request
  File "/usr/lib/python2.7/", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/", line 1473, in parse_response
    return u.close()
  File "/usr/lib/python2.7/", line 793, in close
    raise Fault(**self._stack[0])
Fault: <Fault 3: 'Invalid api path.'>

Have you any idea ??????