If there is not journal_id in context as well as there is no move_id in context then you use "search_default_journal_id" to replace in context['journal_id']. I think this is not correct. Each time if you change the journal from search view and try to create entries. It pass old search_default_journal_id in context always.
And if you use Accounting/Journal Entries/Journal Items menu to create journal entries, you can see it will not work with your code.
If there is not journal_id in context as well as there is no move_id in context then you use "search_ default_ journal_ id" to replace in context[ 'journal_ id']. I think this is not correct. Each time if you change the journal from search view and try to create entries. It pass old search_ default_ journal_ id in context always.
And if you use Accounting/Journal Entries/Journal Items menu to create journal entries, you can see it will not work with your code.
Thanks,
Mustufa