From 5e64318f94015276c51799e02448c16640c74e20 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 31 Aug 2011 15:11:41 +0200 Subject: [PATCH] [IMP] attempt to make handling of readonly & states.readonly slightly clearer bzr revid: xmo@openerp.com-20110831131141-wu0f4p6etaou3xdl --- addons/base/controllers/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index 581382808e3..606179e629a 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -1100,11 +1100,10 @@ class Export(View): records = [] for field_name, field in fields_seq: if import_compat and field.get('readonly'): - ok = False - for sl in field.get('states', {}).values(): - for s in sl: - ok = ok or (s==['readonly',False]) - if not ok: continue + # If none of the field's states unsets readonly, skip the field + if all(dict(attrs).get('readonly', True) + for attrs in field.get('states', {}).values()): + continue id = prefix + (prefix and '/'or '') + field_name nm = name + (name and '/' or '') + field['string']