changeset df0ab6c15d14 in modules/stock:6.0 details: https://hg.tryton.org/modules/stock?cmd=changeset&node=df0ab6c15d14 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 (grafted from c994fc728bf3ce1530eebf8fea14960960456d3c) diffstat: inventory.py | 4 +--- move.py | 4 +--- shipment.py | 24 +++++------------------- 3 files changed, 7 insertions(+), 25 deletions(-) diffs (139 lines): diff -r 2aa46fa8284a -r df0ab6c15d14 inventory.py --- a/inventory.py Sat Jan 15 16:24:02 2022 +0100 +++ b/inventory.py Thu Feb 03 22:29:08 2022 +0100 @@ -71,6 +71,7 @@ @classmethod def __setup__(cls): super(Inventory, cls).__setup__() + cls.create_date.select = True cls._order.insert(0, ('date', 'DESC')) cls._transitions |= set(( ('draft', 'done'), @@ -103,9 +104,6 @@ table = cls.__table_handler__(module_name) sql_table = cls.__table__() - # Add index on create_date - table.index_action('create_date', action='add') - # Migration from 5.4: remove lost_found table.not_null_action('lost_found', 'remove') diff -r 2aa46fa8284a -r df0ab6c15d14 move.py --- a/move.py Sat Jan 15 16:24:02 2022 +0100 +++ b/move.py Thu Feb 03 22:29:08 2022 +0100 @@ -299,6 +299,7 @@ @classmethod def __setup__(cls): super(Move, cls).__setup__() + cls.create_date.select = True cls.product.domain = [ If(Bool(Eval('product_uom_category')) & ~Eval('state').in_(['done', 'cancelled']), @@ -367,9 +368,6 @@ super(Move, cls).__register__(module_name) table = cls.__table_handler__(module_name) - # Add index on create_date - table.index_action('create_date', action='add') - # Index for period join in compute_quantities_query table.index_action([ Coalesce(sql_table.effective_date, diff -r 2aa46fa8284a -r df0ab6c15d14 shipment.py --- a/shipment.py Sat Jan 15 16:24:02 2022 +0100 +++ b/shipment.py Thu Feb 03 22:29:08 2022 +0100 @@ -247,6 +247,7 @@ @classmethod def __setup__(cls): super(ShipmentIn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('id', 'DESC'), ] @@ -288,10 +289,6 @@ super(ShipmentIn, cls).__register__(module_name) - # Add index on create_date - table = cls.__table_handler__(module_name) - 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'], @@ -659,6 +656,7 @@ @classmethod def __setup__(cls): super(ShipmentInReturn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -718,10 +716,6 @@ super(ShipmentInReturn, cls).__register__(module_name) - # Add index on create_date - table = cls.__table_handler__(module_name) - 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'], @@ -1047,6 +1041,7 @@ @classmethod def __setup__(cls): super(ShipmentOut, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -1137,9 +1132,6 @@ super(ShipmentOut, cls).__register__(module_name) - # 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'], @@ -1694,6 +1686,7 @@ @classmethod def __setup__(cls): super(ShipmentOutReturn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -1737,10 +1730,6 @@ super(ShipmentOutReturn, cls).__register__(module_name) - # Add index on create_date - table = cls.__table_handler__(module_name) - 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'], @@ -2168,6 +2157,7 @@ @classmethod def __setup__(cls): super(ShipmentInternal, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -2254,10 +2244,6 @@ where=(sql_table.planned_start_date == Null) & (sql_table.planned_date != Null))) - # Add index on create_date - table = cls.__table_handler__(module_name) - 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'],