From 82f8ce61a00d6c5cfa65e3e32b5567b9bf161080 Mon Sep 17 00:00:00 2001 From: Bernat Brunet Date: Tue, 23 Jun 2020 09:20:23 +0200 Subject: [PATCH] Update fifo cost patches, adapting to the new core changes --- issue8700.diff | 2 +- issue9274.diff | 27 --------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/issue8700.diff b/issue8700.diff index 7e8296a..03f637c 100644 --- a/issue8700.diff +++ b/issue8700.diff @@ -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')]) diff --git a/issue9274.diff b/issue9274.diff index 84429f6..54143fa 100644 --- a/issue9274.diff +++ b/issue9274.diff @@ -102,33 +102,6 @@ index 0000000..d1a8c9a + + + -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