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.

23 lines
676 B

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