Add default search value on inventory, move and shipments

This commit is contained in:
Cédric Krier committed 2010-01-23 11:47:04 +01:00
1 parent 0b1199e926
commit b0ffad195c
7 files changed
+48

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
* Add default search value on inventory, move and shipments
Version 1.4.0 - 2009-10-19
* Bug fixes (see mercurial logs for details)
* Add new group "Stock Force Assignment"
+8
View File
@@ -4,6 +4,7 @@
from trytond.model import ModelWorkflow, ModelView, ModelSQL, fields
from trytond.wizard import Wizard
from trytond.pyson import Not, Equal, Eval, Or, Bool
from trytond.backend import TableHandler
STATES = {
'readonly': Not(Equal(Eval('state'), 'draft')),
@@ -46,6 +47,13 @@ class Inventory(ModelWorkflow, ModelSQL, ModelView):
super(Inventory, self).__init__()
self._order.insert(0, ('date', 'DESC'))
def init(self, cursor, module_name):
super(Inventory, 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
@@ -59,6 +59,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="date" select="1"/>
<field name="state" select="1"/>
<field name="company" select="2"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -67,6 +68,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Inventories</field>
<field name="res_model">stock.inventory</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_inventory_form_view1">
+3
View File
@@ -134,6 +134,9 @@ class Move(ModelSQL, ModelView):
table = TableHandler(cursor, self, module_name)
table.drop_constraint('check_packing_in_out')
# Add index on create_date
table.index_action('create_date', action='add')
def default_planned_date(self, cursor, user, context=None):
if context and context.get('planned_date'):
return context.get('planned_date')
+4
View File
@@ -51,6 +51,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="uom" select="2"/>
<field name="state" select="2"/>
<field name="unit_digits" tree_invisible="1"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -59,6 +60,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Moves</field>
<field name="res_model">stock.move</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view" id="act_move_form_view1">
<field name="sequence" eval="1"/>
@@ -79,6 +81,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="res_model">stock.move</field>
<field name="view_type">form</field>
<field name="domain">[('from_location.type', '=', 'supplier')]</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view" id="act_move_form_supp_view1">
<field name="sequence" eval="1"/>
@@ -121,6 +124,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="res_model">stock.move</field>
<field name="view_type">form</field>
<field name="domain">[('to_location.type', '=', 'customer')]</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_move_form_cust_view1">
+19
View File
@@ -129,6 +129,10 @@ class ShipmentIn(ModelWorkflow, ModelSQL, ModelView):
super(ShipmentIn, 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'
@@ -427,6 +431,10 @@ class ShipmentInReturn(ModelWorkflow, ModelSQL, ModelView):
super(ShipmentInReturn, self).init(cursor, module_name)
# Add index on create_date
table = TableHandler(cursor, self, module_name)
table.index_action('create_date', action='add')
def __init__(self):
super(ShipmentInReturn, self).__init__()
self._rpc.update({
@@ -638,6 +646,9 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView):
table = TableHandler(cursor, self, module_name)
table.drop_column('customer_location', exception=True)
# Add index on create_date
table.index_action('create_date', action='add')
def default_state(self, cursor, user, context=None):
return 'draft'
@@ -1066,6 +1077,10 @@ class ShipmentOutReturn(ModelWorkflow, ModelSQL, ModelView):
super(ShipmentOutReturn, 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'
@@ -1457,6 +1472,10 @@ class ShipmentInternal(ModelWorkflow, ModelSQL, ModelView):
super(ShipmentInternal, 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'
+10
View File
@@ -80,6 +80,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="supplier" select="2"/>
<field name="contact_address" select="2"/>
<field name="state" select="1"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -88,6 +89,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Supplier Shipments</field>
<field name="res_model">stock.shipment.in</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_shipment_in_form_view1">
@@ -213,6 +215,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="from_location" select="2"/>
<field name="to_location" select="2"/>
<field name="state" select="1"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -221,6 +224,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Supplier Return Shipments</field>
<field name="res_model">stock.shipment.in.return</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_shipment_in_return_form_view1">
@@ -363,6 +367,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="customer"/>
<field name="delivery_address"/>
<field name="state" select="1"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -383,6 +388,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Customer Shipments</field>
<field name="res_model">stock.shipment.out</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_shipment_out_form_view1">
@@ -556,6 +562,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="from_location" select="2"/>
<field name="to_location" select="2"/>
<field name="state" select="1"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -564,6 +571,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Internal Shipments</field>
<field name="res_model">stock.shipment.internal</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_shipment_internal_form_view1">
@@ -768,6 +776,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="effective_date" select="2"/>
<field name="customer" select="2"/>
<field name="delivery_address" select="2"/>
<field name="create_date" tree_invisible="1" select="2"/>
</tree>
]]>
</field>
@@ -777,6 +786,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Customer Return Shipments</field>
<field name="res_model">stock.shipment.out.return</field>
<field name="view_type">form</field>
<field name="search_value">{'create_date': ['between', Date(delta_years=-1)]}</field>
</record>
<record model="ir.action.act_window.view"
id="act_shipment_out_return_form_view1">