Add on_change attribute to fields and rename __view_look_dom_arch into _view_look_dom_arch

This commit is contained in:
Cédric Krier committed 2008-02-26 17:52:32 +01:00
1 parent 8b6460eb45
commit bb44f45b84
2 files changed
+7 -7

No files matched your search

+2 -1
View File
@@ -47,7 +47,7 @@ class Column(object):
def __init__(self, string='unknown', required=False, readonly=False,
domain=None, context='', states=None, priority=0,
change_default=False, size=None, ondelete="set null",
translate=False, select=False, **args):
translate=False, select=False, on_change=None, **args):
self.states = states or {}
self.string = string
self.readonly = readonly
@@ -63,6 +63,7 @@ class Column(object):
self.group_name = False
self.view_load = 0
self.select = select
self.on_change = on_change
for i in args:
if args[i]:
setattr(self, i, args[i])
+5 -6
View File
@@ -1650,8 +1650,9 @@ class ORM(object):
'translate',
'help',
'select',
'on_change',
):
if getattr(self._columns[field], arg):
if getattr(self._columns[field], arg, False):
res[field][arg] = getattr(self._columns[field], arg)
if not read_access:
res[field]['readonly'] = True
@@ -1739,7 +1740,7 @@ class ORM(object):
and field.localName in ('form', 'tree'):
node.removeChild(field)
xarch, xfields = self.pool.get(relation
).__view_look_dom_arch(cursor, user, field,
)._view_look_dom_arch(cursor, user, field,
context)
views[str(field.localName)] = {
'arch': xarch,
@@ -1803,7 +1804,7 @@ class ORM(object):
context))
return fields_attrs
def __view_look_dom_arch(self, cursor, user, node, context=None):
def _view_look_dom_arch(self, cursor, user, node, context=None):
fields_def = self.__view_look_dom(cursor, user, node, context=context)
arch = node.toxml(encoding="utf-8").replace('\t', '')
fields2 = self.fields_get(cursor, user, fields_def.keys(), context)
@@ -1944,7 +1945,7 @@ class ORM(object):
result['view_id'] = 0
doc = dom.minidom.parseString(result['arch'])
xarch, xfields = self.__view_look_dom_arch(cursor, user, doc,
xarch, xfields = self._view_look_dom_arch(cursor, user, doc,
context=context)
result['arch'] = xarch
result['fields'] = xfields
@@ -1968,8 +1969,6 @@ class ORM(object):
fields_view_get = Cache()(fields_view_get)
_view_look_dom_arch = __view_look_dom_arch
def _where_calc(self, cursor, user, args, active_test=True, context=None):
if context is None:
context = {}