From 27003621da387086d08d505d1a2f522eb80a26e9 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 30 Jun 2015 18:46:42 +0200 Subject: [PATCH] [FIX] stock_landed_cost: what is already out should use different accounts When a landed costs is applied on goods that are already out, these landed costs need to be subtracted in the stock valuation account and added in the output account. (they were just added before) When the landed cost is negative, it needs to do the opposite for what is already out also. --- addons/stock_landed_costs/stock_landed_costs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock_landed_costs/stock_landed_costs.py b/addons/stock_landed_costs/stock_landed_costs.py index 36d44dcb66e..e6ccde996b2 100644 --- a/addons/stock_landed_costs/stock_landed_costs.py +++ b/addons/stock_landed_costs/stock_landed_costs.py @@ -144,10 +144,12 @@ class stock_landed_cost(osv.osv): if qty_out > 0: debit_line = dict(debit_line, name=(line.name + ": " + str(qty_out) + _(' already out')), - quantity=qty_out) + quantity=qty_out, + account_id=already_out_account_id) credit_line = dict(credit_line, name=(line.name + ": " + str(qty_out) + _(' already out')), - quantity=qty_out) + quantity=qty_out, + account_id=debit_account_id) diff = diff * qty_out / line.quantity if diff > 0: debit_line['debit'] = diff