Commit f0b54faf authored by Nicolas Delaby's avatar Nicolas Delaby

Add new Brain for Tracking list which convert date to current timezone

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22717 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c14d0827
......@@ -286,6 +286,26 @@ class InventoryListBrain(ZSQLBrain):
mapping = mapping )
return N_('Unknown')
class TrackingListBrain(InventoryListBrain):
"""
List of aggregated movements
"""
def __init__(self):
if not self.date:
return
# convert the date in the movement's original timezone.
# This is a somehow heavy operation, but fortunatly it's only called when
# the brain is accessed from the Shared.DC.ZRDB.Results.Results instance
obj = self.getObject()
if obj is not None:
movement_list = obj.getAggregateRelatedValueList()
for movement in movement_list:
date = movement.getStartDate() or movement.getStopDate()
if date is not None:
timezone = date.timezone()
self.date = self.date.toZone(timezone)
break
class DeliveryListBrain(InventoryListBrain):
"""
Lists each variation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment