You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
700 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 ACSONE SA/NV
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, models
  5. class AccountMoveLine(models.Model):
  6. _inherit = 'account.move.line'
  7. @api.model_cr
  8. def init(self):
  9. res = super(AccountMoveLine, self).init()
  10. self._cr.execute("""
  11. SELECT indexname FROM pg_indexes
  12. WHERE indexname = 'account_move_line_date_tax_line_id_idx'
  13. """)
  14. if not self._cr.fetchone():
  15. self._cr.execute("""
  16. CREATE INDEX account_move_line_date_tax_line_id_idx
  17. ON account_move_line (date, tax_line_id)
  18. """)
  19. return res