[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 <smetl@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user