From 08dfa9ffc445512f4924516679595bc294a03d49 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Wed, 29 Jan 2020 16:52:36 +0000 Subject: [PATCH] [FIX] account: take into account force_company for default journal The default journal depends on the company define in the context or the company in the environment In case of online signature/payment of a SO in a different company then the public user The company will be wrong and the journal_id as well It lead to a fail of the payment since the payment could not be reconciled with the invoices This is happening because the force_company is not taken into account for the default journal This commit take the force_company into account, it take the precedences on the default_company closes odoo/odoo#44238 X-original-commit: 8158e286b0020daa994b593377a2c99234e66086 Signed-off-by: Laurent Smet --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 44008d108e3..d919d2c95d8 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -54,7 +54,7 @@ class AccountMove(models.Model): if move_type != 'entry' and journal.type != journal_type: raise UserError(_("Cannot create an invoice of type %s with a journal having %s as type.") % (move_type, journal.type)) else: - company_id = self._context.get('default_company_id', self.env.company.id) + company_id = self._context.get('force_company', self._context.get('default_company_id', self.env.company.id)) domain = [('company_id', '=', company_id), ('type', '=', journal_type)] journal = None