changeset 93d6bbe2d2f6 in modules/product_cost_fifo:4.8
details:
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=93d6bbe2d2f6
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 f32526e845da -r 93d6bbe2d2f6 product.py
--- a/product.py Mon Jun 10 19:11:04 2019 +0200
+++ b/product.py Fri Oct 11 11:44:56 2019 +0200
@@ -52,7 +52,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 f32526e845da -r 93d6bbe2d2f6 tests/scenario_product_cost_fifo.rst
--- a/tests/scenario_product_cost_fifo.rst Mon Jun 10 19:11:04 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