From e73d488ebb7554493e2684434a32ed33b733ef9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 3 Feb 2022 22:29:08 +0100 Subject: [PATCH] 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 --- sale.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sale.py b/sale.py index f0a187a039..98c06a0afc 100644 --- a/sale.py +++ b/sale.py @@ -270,6 +270,7 @@ class Sale( @classmethod def __setup__(cls): super(Sale, cls).__setup__() + cls.create_date.select = True cls._order = [ ('sale_date', 'DESC NULLS FIRST'), ('id', 'DESC'), @@ -352,9 +353,6 @@ class Sale( # Migration from 4.0: Drop not null on payment_term table.not_null_action('payment_term', 'remove') - # 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'],