Comment 2 for bug 667711

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']))