changeset 2cc5ed768416 in modules/product_cost_fifo:default
details:
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=2cc5ed768416
description:
Update FIFO cost price recomputation scenario with lost found location
issue9274
review321471002
diffstat:
tests/scenario_product_cost_fifo_recompute_cost_price.rst | 22 +++++++++-----
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (70 lines):
diff -r c6a604d35422 -r 2cc5ed768416
tests/scenario_product_cost_fifo_recompute_cost_price.rst
--- a/tests/scenario_product_cost_fifo_recompute_cost_price.rst Fri Jun 19
00:24:56 2020 +0200
+++ b/tests/scenario_product_cost_fifo_recompute_cost_price.rst Fri Jun 19
00:26:36 2020 +0200
@@ -45,6 +45,7 @@
>>> supplier_loc, = Location.find([('code', '=', 'SUP')])
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> customer_loc, = Location.find([('code', '=', 'CUS')])
+ >>> lost_found, = Location.find([('name', '=', "Lost and Found")])
Create some moves::
@@ -65,6 +66,12 @@
... effective_date=today - dt.timedelta(days=1)).click('do')
>>> StockMove(
... product=product,
+ ... quantity=1,
+ ... from_location=lost_found,
+ ... to_location=storage_loc,
+ ... effective_date=today - dt.timedelta(days=1)).click('do')
+ >>> StockMove(
+ ... product=product,
... quantity=2,
... from_location=storage_loc,
... to_location=customer_loc,
@@ -88,17 +95,16 @@
... product=product,
... quantity=1,
... from_location=storage_loc,
- ... to_location=customer_loc,
- ... unit_price=Decimal('300'),
+ ... to_location=lost_found,
... effective_date=today).click('do')
>>> [m.cost_price for m in StockMove.find([])]
- [Decimal('100.0000'), Decimal('110.0000'), Decimal('105.0000'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('100.0000')]
+ [Decimal('100.0000'), Decimal('116.6666'), Decimal('106.6666'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('113.3333'),
Decimal('100.0000')]
>>> product.reload()
>>> product.cost_price
- Decimal('100.0000')
+ Decimal('99.9998')
Recompute cost price::
@@ -106,11 +112,11 @@
>>> recompute.execute('recompute')
>>> [m.cost_price for m in StockMove.find([])]
- [Decimal('106.6667'), Decimal('106.6667'), Decimal('105.0000'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('100.0000')]
+ [Decimal('111.1111'), Decimal('111.1111'), Decimal('106.6666'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('113.3333'),
Decimal('100.0000')]
>>> product.reload()
>>> product.cost_price
- Decimal('99.9998')
+ Decimal('100.0000')
Recompute cost price from a date::
@@ -119,8 +125,8 @@
>>> recompute.execute('recompute')
>>> [m.cost_price for m in StockMove.find([])]
- [Decimal('106.6667'), Decimal('106.6667'), Decimal('105.0000'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('100.0000')]
+ [Decimal('111.1111'), Decimal('111.1111'), Decimal('106.6666'),
Decimal('110.0000'), Decimal('113.3333'), Decimal('113.3333'),
Decimal('100.0000')]
>>> product.reload()
>>> product.cost_price
- Decimal('99.9998')
+ Decimal('100.0000')