changeset 54224ad4c3f1 in modules/product_cost_fifo:4.4
details: 
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=54224ad4c3f1
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 9b85f2f5462a -r 54224ad4c3f1 product.py
--- a/product.py        Mon Jun 10 19:11:45 2019 +0200
+++ b/product.py        Fri Oct 11 11:44:56 2019 +0200
@@ -48,7 +48,8 @@
             moves = Move.search([
                 ('product.template.id', '=', template.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 9b85f2f5462a -r 54224ad4c3f1 tests/scenario_product_cost_fifo.rst
--- a/tests/scenario_product_cost_fifo.rst      Mon Jun 10 19:11:45 2019 +0200
+++ b/tests/scenario_product_cost_fifo.rst      Fri Oct 11 11:44:56 2019 +0200
@@ -46,6 +46,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 ::
 
@@ -68,13 +70,13 @@
     >>> product.template.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