Default to ordering documents by date
issue10079 review339831002
This commit is contained in:
1 parent
8307d6511f
commit
ccfec0345d
2 files changed
+48
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Default to ordering shipments by date
|
||||
* Add delivery usage to contact mechanism
|
||||
* Make customer's outgoing moves editable for same storage and output zone
|
||||
* Add margin reporting
|
||||
|
||||
+47
-5
@@ -6,6 +6,7 @@ from collections import defaultdict
|
||||
from functools import partial
|
||||
|
||||
from sql import Null
|
||||
from sql.conditionals import Coalesce
|
||||
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import Workflow, ModelView, ModelSQL, fields, dualmethod
|
||||
@@ -194,7 +195,9 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentIn, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('id', 'DESC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'received'),
|
||||
('received', 'done'),
|
||||
@@ -242,6 +245,11 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(table.effective_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_planned_date():
|
||||
return Pool().get('ir.date').today()
|
||||
@@ -595,7 +603,10 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentInReturn, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('effective_date', 'ASC NULLS LAST'),
|
||||
('id', 'ASC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'waiting'),
|
||||
('waiting', 'assigned'),
|
||||
@@ -660,6 +671,11 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(table.effective_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
@@ -971,7 +987,10 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentOut, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('effective_date', 'ASC NULLS LAST'),
|
||||
('id', 'ASC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'waiting'),
|
||||
('waiting', 'assigned'),
|
||||
@@ -1061,6 +1080,11 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(table.effective_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
@@ -1581,7 +1605,10 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentOutReturn, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('effective_date', 'ASC NULLS LAST'),
|
||||
('id', 'ASC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('draft', 'received'),
|
||||
('received', 'done'),
|
||||
@@ -1630,6 +1657,11 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(table.effective_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
@@ -2043,7 +2075,10 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ShipmentInternal, cls).__setup__()
|
||||
cls._order[0] = ('id', 'DESC')
|
||||
cls._order = [
|
||||
('effective_date', 'ASC NULLS LAST'),
|
||||
('id', 'ASC'),
|
||||
]
|
||||
cls._transitions |= set((
|
||||
('request', 'draft'),
|
||||
('draft', 'waiting'),
|
||||
@@ -2135,6 +2170,13 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
@classmethod
|
||||
def order_effective_date(cls, tables):
|
||||
table, _ = tables[None]
|
||||
return [Coalesce(
|
||||
table.effective_start_date, table.effective_date,
|
||||
table.planned_start_date, table.planned_date)]
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
|
||||
Reference in new issue
Block a user