changeset c994fc728bf3 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=c994fc728bf3
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:
inventory.py | 4 +---
move.py | 4 +---
shipment.py | 24 +++++-------------------
3 files changed, 7 insertions(+), 25 deletions(-)
diffs (139 lines):
diff -r 887960a8421a -r c994fc728bf3 inventory.py
--- a/inventory.py Sun Jan 30 01:37:46 2022 +0100
+++ b/inventory.py Thu Feb 03 22:29:08 2022 +0100
@@ -72,6 +72,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'),
@@ -104,9 +105,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 887960a8421a -r c994fc728bf3 move.py
--- a/move.py Sun Jan 30 01:37:46 2022 +0100
+++ b/move.py Thu Feb 03 22:29:08 2022 +0100
@@ -296,6 +296,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']),
@@ -364,9 +365,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 887960a8421a -r c994fc728bf3 shipment.py
--- a/shipment.py Sun Jan 30 01:37:46 2022 +0100
+++ b/shipment.py Thu Feb 03 22:29:08 2022 +0100
@@ -249,6 +249,7 @@
@classmethod
def __setup__(cls):
super(ShipmentIn, cls).__setup__()
+ cls.create_date.select = True
cls._order = [
('id', 'DESC'),
]
@@ -290,10 +291,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'],
@@ -667,6 +664,7 @@
@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 @@
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 @@
@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 @@
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 @@
@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 @@
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 @@
@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 @@
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'],