[FIX] account: journal taken into account

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) <wan@odoo.com>
This commit is contained in:
det
2023-02-14 17:09:16 +01:00
parent 430967a882
commit 8efa991f0a
+1 -1
View File
@@ -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