Add default search value on forecast

This commit is contained in:
Cédric Krier committed 2010-01-23 11:47:52 +01:00
1 parent b808a16287
commit 1156bbfd3d
3 files changed
+11

No files matched your search

+1
View File
@@ -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
+8
View File
@@ -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'
+2
View File
@@ -72,6 +72,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="from_date"/>
<field name="to_date"/>
<field name="company" select="2"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -80,6 +81,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Forecasts</field>
<field name="res_model">stock.forecast</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-2)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_forecast_form_view1">