Update fifo cost patches, adapting to the new core changes
This commit is contained in:
parent
a018f92fa7
commit
82f8ce61a0
|
@ -117,7 +117,7 @@ Index: trytond/trytond/modules/product_cost_fifo/product.py
|
|||
- moves = Move.search([
|
||||
- ('product', '=', product.id),
|
||||
- ('state', '=', 'done'),
|
||||
- ('from_location.type', 'in', ['supplier', 'production']),
|
||||
- ('from_location.type', '!=', 'storage'),
|
||||
- ('to_location.type', '=', 'storage'),
|
||||
- ], offset=offset, limit=limit,
|
||||
- order=[('effective_date', 'DESC'), ('id', 'DESC')])
|
||||
|
|
|
@ -102,33 +102,6 @@ index 0000000..d1a8c9a
|
|||
+ </record>
|
||||
+ </data>
|
||||
+</tryton>
|
||||
diff --git a/move.py b/move.py
|
||||
index 91a7b07..a7393dd 100644
|
||||
--- a/trytond/trytond/modules/product_cost_fifo/move.py
|
||||
+++ b/trytond/trytond/modules/product_cost_fifo/move.py
|
||||
@@ -81,13 +81,15 @@ class Move(metaclass=PoolMeta):
|
||||
to_save = []
|
||||
for move, move_qty in fifo_moves:
|
||||
consumed_qty += move_qty
|
||||
-
|
||||
- with Transaction().set_context(date=move.effective_date):
|
||||
- move_unit_price = Currency.compute(
|
||||
- move.currency, move.unit_price,
|
||||
- self.company.currency, round=False)
|
||||
- move_unit_price = Uom.compute_price(move.uom, move_unit_price,
|
||||
- move.product.default_uom)
|
||||
+ if move.from_location.type in {'supplier', 'production'}:
|
||||
+ with Transaction().set_context(date=move.effective_date):
|
||||
+ move_unit_price = Currency.compute(
|
||||
+ move.currency, move.unit_price,
|
||||
+ self.company.currency, round=False)
|
||||
+ move_unit_price = Uom.compute_price(move.uom, move_unit_price,
|
||||
+ move.product.default_uom)
|
||||
+ else:
|
||||
+ move_unit_price = move.cost_price or 0
|
||||
cost_price += move_unit_price * Decimal(str(move_qty))
|
||||
|
||||
move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
|
||||
diff --git a/product.py b/product.py
|
||||
index 9eaceac..8b5aa0a 100644
|
||||
--- a/trytond/trytond/modules/product_cost_fifo/product.py
|
||||
|
|
Loading…
Reference in New Issue