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.

22 lines
632 B

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