[FIX] apply some merge review feeback
bzr revid: al@openerp.com-20110712143532-s0jeuh5rglzwijpn
This commit is contained in:
parent
98bc95933f
commit
7c01ea22f3
|
@ -79,19 +79,19 @@ ROOT_USER_ID = 1
|
|||
def transfer_field_to_modifiers(field, modifiers):
|
||||
default_values = {}
|
||||
state_exceptions = {}
|
||||
for a in ('invisible', 'readonly', 'required'):
|
||||
default_values[a] = False
|
||||
state_exceptions[a] = []
|
||||
if field.get(a):
|
||||
default_values[a] = bool(field.get(a))
|
||||
for state, modifs in (field.get("states") or {}).items():
|
||||
for attr in ('invisible', 'readonly', 'required'):
|
||||
state_exceptions[attr] = []
|
||||
default_values[attr] = bool(field.get(attr))
|
||||
for state, modifs in (field.get("states",{})).items():
|
||||
for modif in modifs:
|
||||
if(default_values[modif[0]] != modif[1]):
|
||||
if default_values[modif[0]] != modif[1]:
|
||||
state_exceptions[modif[0]].append(state)
|
||||
|
||||
|
||||
for attr, default_value in default_values.items():
|
||||
modifiers[attr] = [("state", "not in" if default_value else "in", state_exceptions[attr])] \
|
||||
if state_exceptions[attr] else default_value
|
||||
if state_exceptions[attr]:
|
||||
modifiers[attr] = [("state", "not in" if default_value else "in", state_exceptions[attr])]
|
||||
else:
|
||||
modifiers[attr] = default_value
|
||||
|
||||
|
||||
# Don't deal with groups, it is done by check_group().
|
||||
|
|
Loading…
Reference in New Issue