Stock move never updated after canceling an inventory

Bug #782234 reported by Guewen Baconnier @ Camptocamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
Fix Released
Undecided
Guewen Baconnier @ Camptocamp

Bug Description

Steps to reproduce :
1. Create an inventory and add 5 units of a product. Confirm it.
2. Export the stock levels to Magento. The stock is at 5 units on Magento.
3. Cancel the inventory on OpenERP. -> The stock level is at 0 on OpenERP.
4. Export again the stock levels to Magento. But the stock is still at 5 on Magento.

This is because the list of product for which the stock levels have to be updated excludes all the stock moves in a cancelled state :
base_sale_multichannels/sale.py: sale_shop.export_inventory
    recent_move_ids = self.pool.get('stock.move').search(cr, uid, [('date_planned', '>', shop.last_inventory_export_date), ('product_id', 'in', product_ids), ('state', '!=', 'draft'), ('state', '!=', 'cancel')])

For me, when a stock move is cancelled, it means that the stock has increased.
So we have to update the stock level of the product.

Correction would just be to replace the line by :
recent_move_ids = self.pool.get('stock.move').search(cr, uid, [('date_planned', '>', shop.last_inventory_export_date), ('product_id', 'in', product_ids), ('state', '!=', 'draft')])

What are your opinions ?

Related branches

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Fixed in base_sale_multichannels for v5 and v6.

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