From 8efa991f0a76147b4657463679511af84b277e1b Mon Sep 17 00:00:00 2001 From: det Date: Mon, 30 Jan 2023 11:41:40 +0000 Subject: [PATCH] [FIX] account: journal taken into account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fix an issue on moves creation from attachments. Before, when creating moves from attachment, if no method is found the 'self' journal is not taken into account. After, the journal found or contained in 'self' is used while creating the move [community](https://github.com/odoo/odoo/pull/111328) [enterprise](https://github.com/odoo/enterprise/pull/36308) closes odoo/odoo#111328 Related: odoo/enterprise#36308 Signed-off-by: William André (wan) --- addons/account/models/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index 066a6911465..0edd079131e 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -719,7 +719,7 @@ class AccountJournal(models.Model): if invoice: break if not invoice: - invoice = self.env['account.move'].create({}) + invoice = self.env['account.move'].create({'journal_id': self.id}) invoice.with_context(no_new_invoice=True).message_post(attachment_ids=[attachment.id]) attachment.write({'res_model': 'account.move', 'res_id': invoice.id}) invoices += invoice