From 284b9a005fd42d9b2cc99ff30e2549f14ad02287 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 (grafted from 4d2ae547c0a2512afea385dfeed074e524eb4c4b) --HG-- branch : 6.0 --- sale.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sale.py b/sale.py index 94897f98cf..980021e582 100644 --- a/sale.py +++ b/sale.py @@ -282,6 +282,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'), @@ -364,9 +365,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'],