This commit is contained in:
Mathias Behrle committed 2009-02-09 23:26:41 +01:00
commit 3c34f1b09b
1 file changed
+13 -2
+13 -2
View File
@@ -34,8 +34,8 @@ class Location(OSV):
], 'Location type', states=STATES)
parent = fields.Many2One("stock.location", "Parent", select=1,
left="left", right="right")
left = fields.Integer('Left', required=True)
right = fields.Integer('Right', required=True)
left = fields.Integer('Left', required=True, select=1)
right = fields.Integer('Right', required=True, select=1)
childs = fields.One2Many("stock.location", "parent", "Childs")
input_location = fields.Many2One(
"stock.location", "Input", states={
@@ -81,6 +81,17 @@ class Location(OSV):
'cannot be changed to a type that does not support moves.',
})
def init(self, cursor, module_name):
super(Location, self).init(cursor, module_name)
cursor.execute('SELECT indexname FROM pg_indexes ' \
'WHERE indexname = ' \
'\'stock_location_left_right_index\'')
if not cursor.rowcount:
cursor.execute('CREATE INDEX ' \
'stock_location_left_right_index ' \
'ON stock_location ("left", "right")')
def check_type_for_moves(self, cursor, user, ids):
""" Check locations with moves have types compatible with moves. """
invalid_move_types = ['warehouse', 'view']