Merge pull request #417 from gurneyalex/7.0-fix_1311004_account_move_line_index-afe

[IMP] account.move.line: extra index on (date, id) corresponding to the default _order, courtesy of @gurneyalex.

 Fixes https://bugs.launchpad.net/openobject-addons/+bug/1311004
This commit is contained in:
odony 2014-06-11 16:41:29 +02:00
commit 5d77de54e5
1 changed files with 3 additions and 0 deletions

View File

@ -566,6 +566,9 @@ class account_move_line(osv.osv):
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('account_move_line_date_id_index',))
if not cr.fetchone():
cr.execute('CREATE INDEX account_move_line_date_id_index ON account_move_line (date DESC, id desc)')
return res
def _check_no_view(self, cr, uid, ids, context=None):