From 23e11d7cbfb7bfdb38653219dcd33be1f45010d7 Mon Sep 17 00:00:00 2001 From: Artem Kostyuk Date: Mon, 23 Jul 2018 15:46:54 +0300 Subject: [PATCH] [FIX] Prevent negative qtys from appearing in account.move.lines --- stock_account_internal_move/models/stock_move.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stock_account_internal_move/models/stock_move.py b/stock_account_internal_move/models/stock_move.py index 40c985047..8a33a3715 100644 --- a/stock_account_internal_move/models/stock_move.py +++ b/stock_account_internal_move/models/stock_move.py @@ -20,6 +20,12 @@ class StockMove(models.Model): == 'internal'): continue + # treated by `super()` as a move w/ negative qty due to this hunk: + # quantity = self.product_qty or context.get('forced_quantity') + # quantity = quantity if self._is_in() else -quantity + # so, move qty is flipped twice and thus preserved + move = move.with_context(forced_quantity=-move.product_qty) + location_from = move.location_id location_to = move.location_dest_id