Make fields with domain operator '=' becomes readonly.
Sent also readonly field for the creation of the record. states attribute can not change the readonly attributes that is on the object.
This commit is contained in:
1 parent
cc3ec7a0f5
commit
69a340ca81
3 files changed
+5
-1
No files matched your search
@@ -101,6 +101,8 @@ class CharField(object):
|
||||
if isinstance(state_changes, basestring):
|
||||
state_changes = eval(state_changes)
|
||||
for key in ('readonly', 'required', 'invisible'):
|
||||
if 'readonly' in self.attrs and self.attrs['readonly']:
|
||||
continue
|
||||
if key in state_changes:
|
||||
self.get_state_attrs(model)[key] = \
|
||||
eval(state_changes[key], values)
|
||||
|
||||
@@ -120,7 +120,7 @@ class ModelRecord(SignalEvent):
|
||||
def save(self, force_reload=True):
|
||||
self._check_load()
|
||||
if not self.id:
|
||||
value = self.get(get_readonly=False)
|
||||
value = self.get(get_readonly=True)
|
||||
try:
|
||||
self.id = self.rpc.create(value, self.context_get())
|
||||
except Exception, exception:
|
||||
|
||||
@@ -297,6 +297,8 @@ class Screen(SignalEvent):
|
||||
field_dom = str(fields[dom[0]].setdefault('domain',[]))
|
||||
fields[dom[0]]['domain'] = field_dom[:1] + \
|
||||
str(('id', dom[1], dom[2])) + ',' + field_dom[1:]
|
||||
if dom[1] == '=':
|
||||
fields[dom[0]]['readonly'] = True
|
||||
for node in xml_dom.childNodes:
|
||||
if node.localName == 'tree':
|
||||
self.fields_view_tree = {'arch': arch, 'fields': fields}
|
||||
|
||||
Reference in new issue
Block a user