Default to ordering documents by date
issue10079 review339831002
This commit is contained in:
1 parent
c95779bc72
commit
93734cb82b
1 file changed
+10
-1
@@ -4,6 +4,7 @@ from collections import defaultdict
|
||||
from decimal import Decimal
|
||||
|
||||
from sql import Column
|
||||
from sql.conditionals import Coalesce
|
||||
from sql.operators import Concat
|
||||
from sql.aggregate import Count
|
||||
|
||||
@@ -260,7 +261,10 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentDrop, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('effective_date', 'ASC NULLS LAST'),
|
||||
('id', 'DESC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'waiting'),
|
||||
('waiting', 'shipped'),
|
||||
@@ -297,6 +301,11 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
|
||||
},
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(table.effective_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
|
||||
Reference in new issue
Block a user