[FIX] account: Selecting a journal from Journal entries

Steps to reproduce the bug:

- Go to Accounting (module)> Accounting (menu) > Journal Entries
- Create a new account move M
- Remove the default journal

Bug:

Impossible to set a journal

opw:2445553

closes odoo/odoo#65200

X-original-commit: cd1823a1066dd9a820afed8427e3a9abc2faade0
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2021-01-28 10:25:39 +00:00
parent afb1db326c
commit 23f1a57f63
+2 -1
View File
@@ -1053,7 +1053,8 @@ class AccountMove(models.Model):
def _compute_suitable_journal_ids(self):
for m in self:
journal_type = m.invoice_filter_type_domain or 'general'
domain = [('company_id', '=', m.company_id.id), ('type', '=', journal_type)]
company_id = m.company_id.id or self.env.company.id
domain = [('company_id', '=', company_id), ('type', '=', journal_type)]
m.suitable_journal_ids = self.env['account.journal'].search(domain)
@api.depends('posted_before', 'state', 'journal_id', 'date')