import product quantity from magento (stock)

Asked by Juhász Miklós on 2010-08-06

Hi!
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?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Magento OpenERP Connector Edit question
Assignee:
No assignee Edit question
Solved by:
ntrubert-cobweb
Solved:
2010-08-24
Last query:
2010-08-24
Last reply:
2010-08-24
ntrubert-cobweb (ntrubert) said : #1

Hi,

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.

Juhász Miklós (mindegy) said : #2

Hello!
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.

Best ntrubert-cobweb (ntrubert) said : #3

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.

Juhász Miklós (mindegy) said : #4

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

Diogo Velho (diogovelho) said : #5

Hi,

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 https://bugs.launchpad.net/magentoerpconnect/+bug/667711
and all the products whent to stock 0 in magento (expected) But the HTC diamond remained untouched.

Can someone help me please?

Thanks

Diogo Velho (diogovelho) said : #6

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

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/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/openerp-6.1-1/openerp/osv/osv.py", 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/export_product.py", 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/export_product.py", 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/product.py", 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/export_product.py", 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/external_osv.py", 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/decorator.py", line 49, in wrapped
    return func(self, cr, uid, argument, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/base_external_referentials/decorator.py", line 110, in wrapper
    return func(self, cr, uid, external_session, resource, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/magerp_osv.py", 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/external_osv.py", 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/product.py", 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/product.py", 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/decorator.py", line 110, in wrapper
    return func(self, cr, uid, external_session, resource, *args, **kwargs)
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/product.py", line 1452, in _export_inventory
    [mag_product_id, inventory_vals])
  File "/opt/openerp/openerp-6.1-1/openerp/addons/magentoerpconnect/magerp_osv.py", line 223, in call
    res = self.ser.call(self.session, method, arguments)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
Fault: <Fault 3: 'Invalid api path.'>

Have you any idea ??????