Comment 2 for bug 944079

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I am having the same error, but in "Journal Items". The crash happens both with an up-to-date OpenERP 6.1 and an up-to-date OpenERP trunk when using the Gtk client (I didn't test with the Web client)

Here is the bug scenario :
1. Open "Accounting > Journal Entries > Journal Items"
2. Set a Journal and a Period, then click on "Find"
3. Click on "New". Enter a date, an account, a name, a value for Debit or Credit
4. Press Enter to get a new line -> CRASH

You will find enclosed a screenshot. Here is the backtrace (trunk version) :

Traceback (most recent call last):
  File "/home/alexis/new_boite/dev/server-trunk/openerp/service/netrpc_server.py", line 64, in run
    result = netsvc.dispatch_rpc(msg[0], msg[1], msg[2:])
  File "/home/alexis/new_boite/dev/server-trunk/openerp/netsvc.py", line 362, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/alexis/new_boite/dev/server-trunk/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/home/alexis/new_boite/dev/server-trunk/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/alexis/new_boite/dev/server-trunk/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/alexis/new_boite/dev/server-trunk/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/alexis/new_boite/dev/addons-trunk/account/account_move_line.py", line 1246, in create
    self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
KeyError: 'journal_id'

When I look into the code with some prints, here is what I see :

When I enter the "create" function, I have this context : {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'department_id': False, 'period_id': 3, 'active_ids': [171], 'active_id': 171}

Just before I reach self._update_journal_check, here is the value of context : {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'department_id': False, 'period_id': 3, 'active_ids': [171], 'active_id': 171}

The context doesn't have a "journal_id" key. From my understanding (but I may be wrong), as I have set a Journal via the seach view, I should have a key "search_default_journal_id" that is used to create the key "journal_id" right before the execution of self._update_journal_check. But I don't have this key "search_default_journal_id" in my context... and that's the problem I think.