← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~numerigraphe-team/ocb-addons/7.0-inventory-dummy-moves-test into lp:ocb-addons

 

Lionel Sausin - Numérigraphe has proposed merging lp:~numerigraphe-team/ocb-addons/7.0-inventory-dummy-moves-test into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1228156 in OpenERP Addons: "Wizard "Fill inventory" creates wrong lines for moves where source=destination"
  https://bugs.launchpad.net/openobject-addons/+bug/1228156

For more details, see:
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-dummy-moves-test/+merge/215453

This branch adds a YAML test to detect possible regressions regarding bug #1228156.
It runs green on runbot: http://runbot.openerp.com/numerigraphe-team-7-0-ocb-runbot-inventory-dummy-moves-test-30874/logs/
Upstream MP: https://code.launchpad.net/~numerigraphe-team/openobject-addons/7.0-inventory-dummy-moves-test/+merge/214910
-- 
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-dummy-moves-test/+merge/215453
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~numerigraphe-team/ocb-addons/7.0-inventory-dummy-moves-test into lp:ocb-addons.
=== modified file 'stock/__openerp__.py'
--- stock/__openerp__.py	2014-04-04 18:52:40 +0000
+++ stock/__openerp__.py	2014-04-11 16:06:15 +0000
@@ -96,6 +96,7 @@
         'test/shipment.yml',
         'test/stock_report.yml',
         'test/stock_move_chain_validation.yml',
+        'test/stock_inventory_dummy_moves.yml',
     ],
     'installable': True,
     'application': True,

=== added file 'stock/test/stock_inventory_dummy_moves.yml'
--- stock/test/stock_inventory_dummy_moves.yml	1970-01-01 00:00:00 +0000
+++ stock/test/stock_inventory_dummy_moves.yml	2014-04-11 16:06:15 +0000
@@ -0,0 +1,51 @@
+-
+  This file test will verify the bug reported at https://bugs.launchpad.net/openobject-addons/+bug/1228156.
+  In order to test the bug fix, I will create stock move with same location for source and destination location,
+  create inventory, import inventory lines
+-
+  I create stock move with same source and destination location for product_pc2.
+-
+ !record {model: stock.move, id: same_location_move}:
+    name: 'Test move with same source and destination location'
+    location_id: stock_location_14
+    location_dest_id: stock_location_14
+    product_id: product.product_product_9
+    product_qty: 12.0
+    product_uom: product.product_uom_unit
+    state: 'done'
+-
+  I create inventory.
+-
+   !record {model: stock.inventory, id: stock_inventory_same_location}:
+    company_id: base.main_company
+    date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+    date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S')
+    name: Physical inventory
+    state: draft
+-
+  I create a stock.fill.inventory wizard .
+-
+  !record {model: stock.fill.inventory, id: stock_fill_inventory_1}:
+    location_id: stock.stock_location_14
+-
+  I fill the inventory for location stock_location_14.
+-    
+  !python {model: stock.fill.inventory}: |
+    from osv import osv
+    try:
+      self.fill_inventory(cr, uid, [ref("stock_fill_inventory_1")], {"lang": 'en_US',
+        "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
+        [ref("stock_inventory_same_location")], "active_id": ref("stock_inventory_same_location"), })
+    except osv.except_osv:
+      # The wizard may throw an exception since there is actually nothing to import
+      pass
+-
+  I confirm and validate inventory - the quantity available must not change
+-
+  !python {model: stock.inventory}: |
+    prod_obj = self.pool.get("product.product")
+    old_qty = prod_obj.read(cr, uid, [ref('product.product_product_9')], ['qty_available'])[0]['qty_available']
+    self.action_confirm(cr,uid,[ref('stock_inventory_same_location')])
+    self.action_done(cr,uid,[ref('stock_inventory_same_location')])
+    new_qty = prod_obj.read(cr, uid, [ref('product.product_product_9')], ['qty_available'])[0]['qty_available']
+    assert old_qty == new_qty, "The quantity available should not change (%s -> %s)." % (old_qty, new_qty)


Follow ups