From 48a7dbf27faa72e1a58ba160f4c8340cacbb6434 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 2 Oct 2018 16:24:52 +0200 Subject: [PATCH] [FIX] stock_account: return dropship Backport of commit 2e6c1aa5d16f4ede8d9d685336c59e0cac34d487 opw-1885628 --- addons/stock_account/models/stock.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index 4d82e28ebd1..f49bfb3bed3 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -118,10 +118,13 @@ class StockQuant(models.Model): else: self.with_context(force_company=company_from.id)._create_account_move_line(move, acc_valuation, acc_dest, journal_id) - if move.company_id.anglo_saxon_accounting and move.location_id.usage == 'supplier' and move.location_dest_id.usage == 'customer': + if move.company_id.anglo_saxon_accounting: # Creates an account entry from stock_input to stock_output on a dropship move. https://github.com/odoo/odoo/issues/12687 journal_id, acc_src, acc_dest, acc_valuation = move._get_accounting_data_for_valuation() - self.with_context(force_company=move.company_id.id)._create_account_move_line(move, acc_src, acc_dest, journal_id) + if move.location_id.usage == 'supplier' and move.location_dest_id.usage == 'customer': + self.with_context(force_company=move.company_id.id)._create_account_move_line(move, acc_src, acc_dest, journal_id) + if move.location_id.usage == 'customer' and move.location_dest_id.usage == 'supplier': + self.with_context(force_company=move.company_id.id)._create_account_move_line(move, acc_dest, acc_src, journal_id) def _create_account_move_line(self, move, credit_account_id, debit_account_id, journal_id): # group quants by cost