diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index f1034572ecc..f6bcb05d656 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -179,11 +179,11 @@ class PosSession(models.Model): # define some cash journal if no payment method exists if not pos_config.journal_ids: Journal = self.env['account.journal'] - journals = Journal.with_context(ctx).search([('journal_user', '=', True), ('type', '=', 'cash')]) + journals = Journal.with_context(ctx).search([('journal_user', '=', True), ('type', '=', 'cash'), ('company_id', '=', pos_config.company_id.id)]) if not journals: - journals = Journal.with_context(ctx).search([('type', '=', 'cash')]) + journals = Journal.with_context(ctx).search([('type', '=', 'cash'), ('company_id', '=', pos_config.company_id.id)]) if not journals: - journals = Journal.with_context(ctx).search([('journal_user', '=', True)]) + journals = Journal.with_context(ctx).search([('journal_user', '=', True), ('company_id', '=', pos_config.company_id.id)]) journals.sudo().write({'journal_user': True}) pos_config.sudo().write({'journal_ids': [(6, 0, journals.ids)]})