changeset 4f0fb1562d19 in modules/product_cost_fifo:5.2
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=4f0fb1562d19
description:
        Include production moves in FIFO computation

        issue8659
        review264211002
        (grafted from 4d1ec7e59853ce5a773d8a9b32e4c9ab6ebf567f)
diffstat:

 product.py                           |  3 ++-
 tests/scenario_product_cost_fifo.rst |  6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r f4710591683e -r 4f0fb1562d19 product.py
--- a/product.py        Mon May 06 15:06:16 2019 +0200
+++ b/product.py        Fri Oct 11 11:44:56 2019 +0200
@@ -50,7 +50,8 @@
             moves = Move.search([
                 ('product', '=', product.id),
                 ('state', '=', 'done'),
-                ('from_location.type', '=', 'supplier'),
+                ('from_location.type', 'in', ['supplier', 'production']),
+                ('to_location.type', '=', 'storage'),
                 ], offset=offset, limit=limit,
                 order=[('effective_date', 'DESC'), ('id', 'DESC')])
             if not moves:
diff -r f4710591683e -r 4f0fb1562d19 tests/scenario_product_cost_fifo.rst
--- a/tests/scenario_product_cost_fifo.rst      Mon May 06 15:06:16 2019 +0200
+++ b/tests/scenario_product_cost_fifo.rst      Fri Oct 11 11:44:56 2019 +0200
@@ -45,6 +45,8 @@
     >>> supplier_loc, = Location.find([('code', '=', 'SUP')])
     >>> customer_loc, = Location.find([('code', '=', 'CUS')])
     >>> storage_loc, = Location.find([('code', '=', 'STO')])
+    >>> production_loc = Location(name="Production", type='production')
+    >>> production_loc.save()
 
 Make 4 units of the product available @ 10 ::
 
@@ -67,13 +69,13 @@
     >>> product.cost_price
     Decimal('10.0000')
 
-Add 2 more units @ 25::
+Add 2 more units @ 25 from production::
 
     >>> incoming_move = StockMove()
     >>> incoming_move.product = product
     >>> incoming_move.uom = unit
     >>> incoming_move.quantity = 2
-    >>> incoming_move.from_location = supplier_loc
+    >>> incoming_move.from_location = production_loc
     >>> incoming_move.to_location = storage_loc
     >>> incoming_move.planned_date = today
     >>> incoming_move.company = company

Reply via email to