← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 782234] Re: Stock move never updated after canceling an inventory

 

Fixed in base_sale_multichannels for v5 and v6.

** Changed in: magentoerpconnect
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/782234

Title:
  Stock move never updated after canceling an inventory

Status in Magento Open ERP Connector:
  Fix Released

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 ?


References