more attributes in virtual fields, thanks Donatas Burba

This commit is contained in:
Massimo
2013-02-26 11:40:59 -06:00
parent b441e99e95
commit 0def24381e
2 changed files with 13 additions and 2 deletions

View File

@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.02.25.23.19.14
Version 2.4.1-alpha.2+timestamp.2013.02.26.11.40.15

View File

@@ -9027,9 +9027,20 @@ class SQLCustomType(object):
return self._class
class FieldVirtual(object):
def __init__(self, name, f=None):
def __init__(self, name, f=None, ftype='string',label=None,table_name=None):
# for backward compatibility
(self.name, self.f) = (name, f) if f else ('unkown', name)
self.type = ftype
self.label = label or self.name.capitalize().replace('_',' ')
self.represent = IDENTITY
self.formatter = IDENTITY
self.comment = None
self.readable = True
self.writable = False
self.requires = None
self.widget = None
self.tablename = table_name
self.filter_out = None
class FieldMethod(object):
def __init__(self, name, f=None, handler=None):