From 1156bbfd3d5d91b638596ed3e3e17ebc4093c60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 23 Jan 2010 11:47:52 +0100 Subject: [PATCH] Add default search value on forecast --- CHANGELOG | 1 + forecast.py | 8 ++++++++ forecast.xml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f2908a4b36..56eafa3f46 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add default search value on forecast * Remove egenix-mx-base and replace it by python-dateutil Version 1.4.0 - 2009-10-19 diff --git a/forecast.py b/forecast.py index 4b9c8ae207..8097ecc4c8 100644 --- a/forecast.py +++ b/forecast.py @@ -3,6 +3,7 @@ from trytond.model import ModelView, ModelWorkflow, ModelSQL, fields from trytond.wizard import Wizard from trytond.pyson import Not, Equal, Eval, Or, Bool +from trytond.backend import TableHandler import datetime import time from dateutil.relativedelta import relativedelta @@ -62,6 +63,13 @@ class Forecast(ModelWorkflow, ModelSQL, ModelView): self._order.insert(0, ('from_date', 'DESC')) self._order.insert(1, ('location', 'ASC')) + def init(self, cursor, module_name): + super(Forecast, self).init(cursor, module_name) + + # Add index on create_date + table = TableHandler(cursor, self, module_name) + table.index_action('create_date', action='add') + def default_state(self, cursor, user, context=None): return 'draft' diff --git a/forecast.xml b/forecast.xml index ce3574416f..9820728bbd 100644 --- a/forecast.xml +++ b/forecast.xml @@ -72,6 +72,7 @@ this repository contains the full copyright notices and license terms. --> + ]]> @@ -80,6 +81,7 @@ this repository contains the full copyright notices and license terms. --> Forecasts stock.forecast form + {'create_date': ['between', Date(delta_years=-2)]}