diff --git a/inventory.py b/inventory.py index c2c2d16d2e..f705ac3342 100644 --- a/inventory.py +++ b/inventory.py @@ -72,6 +72,7 @@ class Inventory(Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(Inventory, cls).__setup__() + cls.create_date.select = True cls._order.insert(0, ('date', 'DESC')) cls._transitions |= set(( ('draft', 'done'), @@ -104,9 +105,6 @@ class Inventory(Workflow, ModelSQL, ModelView): 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 --git a/move.py b/move.py index 9468bd667f..8ceaf48013 100644 --- a/move.py +++ b/move.py @@ -296,6 +296,7 @@ class Move(Workflow, ModelSQL, ModelView): @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']), @@ -364,9 +365,6 @@ class Move(Workflow, ModelSQL, ModelView): 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 --git a/shipment.py b/shipment.py index e6706fb62a..6d417bae58 100644 --- a/shipment.py +++ b/shipment.py @@ -249,6 +249,7 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(ShipmentIn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('id', 'DESC'), ] @@ -290,10 +291,6 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView): 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'], @@ -667,6 +664,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(ShipmentInReturn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -726,10 +724,6 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): 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'], @@ -1059,6 +1053,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(ShipmentOut, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -1149,9 +1144,6 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): 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'], @@ -1716,6 +1708,7 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(ShipmentOutReturn, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -1759,10 +1752,6 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView): 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'], @@ -2196,6 +2185,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): @classmethod def __setup__(cls): super(ShipmentInternal, cls).__setup__() + cls.create_date.select = True cls._order = [ ('effective_date', 'ASC NULLS LAST'), ('id', 'ASC'), @@ -2282,10 +2272,6 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): 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'],