summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2017-12-12 15:48:30 +0100
committerSimon Lejeune <sle@openerp.com>2017-12-12 16:41:21 +0100
commit24a9d1dee544a0df8ace3f4e5d39cd7b277ae246 (patch)
tree9fca6cd56a5df6076d661e024fd069f4061af634
parentac4155c8dc3b4f54eeb9765e7f17a845d1c60075 (diff)
[ADD] stock: test on inventory and duplicated quants
This is not linked to an issue. I thought there was one so i made the test but actually it's working as expected, so let's commit the test.
-rw-r--r--addons/stock/tests/test_inventory.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/addons/stock/tests/test_inventory.py b/addons/stock/tests/test_inventory.py
index 796fed4bd2d..732050af7e1 100644
--- a/addons/stock/tests/test_inventory.py
+++ b/addons/stock/tests/test_inventory.py
@@ -267,3 +267,31 @@ class TestInventory(TransactionCase):
move_stock_pack._action_done()
self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product1, self.pack_location), 0)
+
+ def test_inventory_7(self):
+ """ Check that duplicated quants create a single inventory line.
+ """
+ owner1 = self.env['res.partner'].create({'name': 'test_inventory_7'})
+ vals = {
+ 'product_id': self.product1.id,
+ 'product_uom_id': self.uom_unit.id,
+ 'owner_id': owner1.id,
+ 'location_id': self.stock_location.id,
+ 'quantity': 1,
+ 'reserved_quantity': 0,
+ }
+ self.env['stock.quant'].create(vals)
+ self.env['stock.quant'].create(vals)
+ self.assertEqual(len(self.env['stock.quant']._gather(self.product1, self.stock_location)), 2.0)
+ self.assertEqual(self.env['stock.quant']._get_available_quantity(self.product1, self.stock_location), 2.0)
+
+ inventory = self.env['stock.inventory'].create({
+ 'name': 'product1',
+ 'filter': 'product',
+ 'location_id': self.stock_location.id,
+ 'product_id': self.product1.id,
+ })
+ inventory.action_start()
+ self.assertEqual(len(inventory.line_ids), 1)
+ self.assertEqual(inventory.line_ids.theoretical_qty, 2)
+