changeset b6547efd68b6 in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=b6547efd68b6
description:
        Use select to True on create_date

        If the index is created only in __register__ then it is dropped before 
being
        created again.

        issue11197
        review389881002
diffstat:

 purchase.py |  4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diffs (21 lines):

diff -r 2f4e966463f3 -r b6547efd68b6 purchase.py
--- a/purchase.py       Sun Jan 30 20:17:47 2022 +0100
+++ b/purchase.py       Thu Feb 03 22:29:08 2022 +0100
@@ -239,6 +239,7 @@
     @classmethod
     def __setup__(cls):
         super(Purchase, cls).__setup__()
+        cls.create_date.select = True
         cls._order = [
             ('purchase_date', 'DESC NULLS FIRST'),
             ('id', 'DESC'),
@@ -359,9 +360,6 @@
                     values=['processing'],
                     where=sql_table.id.in_(sub_query.select(sub_query.id))))
 
-        # Add index on create_date
-        table.index_action('create_date', action='add')
-
         # Migration from 5.6: rename state cancel to cancelled
         cursor.execute(*sql_table.update(
                 [sql_table.state], ['cancelled'],

Reply via email to