Updated issue13211002_190001.diff to current version of stock module

This commit is contained in:
Guillem Barba 2016-08-25 10:10:11 +02:00
parent ec1af0bd47
commit 1b97cc1325
1 changed files with 29 additions and 27 deletions

View File

@ -1,6 +1,6 @@
diff -r 694d32df45f1 inventory.py
--- a/trytond/trytond/modules/stock/inventory.py Wed Jun 17 12:08:14 2015 +0200
+++ b/trytond/trytond/modules/stock/inventory.py Wed Jun 17 12:14:25 2015 +0200
--- a/trytond/trytond/modules/stock/inventory.py Thu Aug 25 09:46:13 2016 +0200
+++ b/trytond/trytond/modules/stock/inventory.py Thu Aug 25 10:05:12 2016 +0200
@@ -1,6 +1,6 @@
#This file is part of Tryton. The COPYRIGHT file at the top level
#of this repository contains the full copyright notices and license terms.
@ -23,13 +23,16 @@ diff -r 694d32df45f1 inventory.py
'''
Complete or update the inventories
'''
@@ -174,25 +179,21 @@
@@ -174,6 +179,7 @@
Line = pool.get('stock.inventory.line')
Product = pool.get('product.product')
+ grouping = cls.grouping()
to_create = []
for inventory in inventories:
# Once done computation is wrong because include created moves
@@ -181,21 +187,16 @@
continue
# Compute product quantities
with Transaction().set_context(stock_date_end=inventory.date):
- pbl = Product.products_by_location([inventory.location.id])
@ -52,7 +55,7 @@ diff -r 694d32df45f1 inventory.py
# Update existing lines
for line in inventory.lines:
if not (line.product.active and
@@ -200,26 +201,28 @@
@@ -203,26 +204,27 @@
and not line.product.consumable):
Line.delete([line])
continue
@ -60,7 +63,6 @@ diff -r 694d32df45f1 inventory.py
- quantity, uom_id = product_qty.pop(line.product.id)
- elif line.product.id in product2uom:
- quantity, uom_id = 0.0, product2uom[line.product.id]
+
+ key = (inventory.location.id,) + line.unique_key
+ if key in pbl:
+ quantity = pbl.pop(key)
@ -91,7 +93,7 @@ diff -r 694d32df45f1 inventory.py
to_create.append(values)
if to_create:
Line.create(to_create)
@@ -310,7 +313,13 @@
@@ -313,7 +315,13 @@
@property
def unique_key(self):
@ -106,7 +108,7 @@ diff -r 694d32df45f1 inventory.py
@classmethod
def cancel_move(cls, lines):
@@ -349,31 +358,27 @@
@@ -352,31 +360,27 @@
origin=self,
)
@ -142,8 +144,8 @@ diff -r 694d32df45f1 inventory.py
- 'uom': uom_id,
}
diff -r 694d32df45f1 tests/scenario_stock_inventory.rst
--- a/trytond/trytond/modules/stock/tests/scenario_stock_inventory.rst Wed Jun 17 12:08:14 2015 +0200
+++ b/trytond/trytond/modules/stock/tests/scenario_stock_inventory.rst Wed Jun 17 12:14:25 2015 +0200
--- a/trytond/trytond/modules/stock/tests/scenario_stock_inventory.rst Thu Aug 25 09:46:13 2016 +0200
+++ b/trytond/trytond/modules/stock/tests/scenario_stock_inventory.rst Thu Aug 25 10:05:12 2016 +0200
@@ -64,13 +64,11 @@
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> customer_loc, = Location.find([('code', '=', 'CUS')])