Product stock management is not set until first stock entry

Bug #667711 reported by Joël Grand-Guillaume @ camptocamp
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
Incomplete
Medium
Unassigned

Bug Description

Hi,

In the product form into the Magento Shop, in the "inventory" section, we have a "Manage Stock" value. This value is set by default to "No" when exporting product.

It will be set to Yes with right stock quantity when we'll sync the product stock level with the website. The thing is, we must first make an stock entry for that.

This is problematic when you create new product. You must make an stock entry in openerp, sync the stock level, make an outgoing stock move (to cancel the first one) and re-sync the stock level in order to have your product set to "Manage stock = Yes".

I would suggest to set this by default to true when a product is of type "stockable" in OpenERP. So when I create a product into OpenERP and it is stockable product, then the "manage stock" is set to True, otherwise, let it as "false".

I think we should may be map the magento field called "use_config_manage_stock" to 1 when product_type is stockable and let the standard export/creation process go.

Regards,

Joël

Changed in magentoerpconnect:
importance: Undecided → Medium
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Tips:

        # Add the products that have no stock.move and type <> 'service' to initiate the
        # "manage stock" = True in Magento. That allow to not wait the first stock.move before showing it
        # in the website
        #
        # Look for product with no move
        cr.execute("SELECT magento_sku From product_product WHERE \
                        product_product.magento_sku is not null AND\
                        product_product.type <> 'service' AND\
                        product_product.id not in (SELECT distinct(stock_move.product_id) FROM stock_move);")

Add this into the export_inventory of sale.shop...

My2Cents

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

My mistake, sorry here the right SQL query:

cr.execute("SELECT magento_sku From product_product p join product_template t on p.product_tmpl_id = t.id WHERE \
                        p.magento_sku is not null AND\
                        t.type <> 'service' AND\
                        p.id not in (SELECT distinct(stock_move.product_id) FROM stock_move);")
 for product in cr.dictfetchall():
            ctx['conn_obj'].call('product_stock.update', [product['magento_sku'], {'qty': 0, 'is_in_stock': False}])
            logger.notifyChannel('ext synchro', netsvc.LOG_INFO, "Successfully updated stock level at %s for product with SKU %s " %(0, product['magento_sku']))

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Do you still experience this?

Changed in magentoerpconnect:
status: New → Incomplete
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.