[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.
This commit is contained in:
Josse Colpaert 2015-06-30 18:46:42 +02:00
parent c65fe46569
commit 27003621da
1 changed files with 4 additions and 2 deletions

View File

@ -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