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.

26 lines
684 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. """
  10. SELECT indexname FROM pg_indexes
  11. WHERE indexname = 'account_move_line_date_tax_line_id_idx'
  12. """
  13. )
  14. if not self._cr.fetchone():
  15. self._cr.execute(
  16. """
  17. CREATE INDEX account_move_line_date_tax_line_id_idx
  18. ON account_move_line (date, tax_line_id)
  19. """
  20. )
  21. return res