From bd31b7c55354d4a3aa9b8eba95a80844449fdfe6 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 26 Sep 2012 15:09:42 +0200 Subject: [PATCH] [API/IMP] fields: cleanup field_to_dict + make @deprecated available in fields_get() Renamed the m2m extra info keys, as their names were quite confusing (third_table?), + removed the "func_obj" key for function fields, as it was a duplicate of the "relation" kay that is already present for all relationship fields. These renames should not break anything, as this info should only be used for debug, but they still constitute an API backwards-incompatible change. bzr revid: odo@openerp.com-20120926130942-doauqgh6v35vhi29 --- openerp/osv/fields.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 037d2a90986..82fb2e9e185 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -1552,24 +1552,16 @@ def field_to_dict(model, cr, user, field, context=None): res['fnct_search'] = field._fnct_search and field._fnct_search.func_name or False res['fnct_inv'] = field._fnct_inv and field._fnct_inv.func_name or False res['fnct_inv_arg'] = field._fnct_inv_arg or False - res['func_obj'] = field._obj or False if isinstance(field, many2many): (table, col1, col2) = field._sql_names(model) - res['related_columns'] = [col1, col2] - res['third_table'] = table - for arg in ('string', 'readonly', 'states', 'size', 'required', 'group_operator', - 'change_default', 'translate', 'help', 'select', 'selectable', 'groups'): - if getattr(field, arg): - res[arg] = getattr(field, arg) - for arg in ('digits', 'invisible', 'filters'): + res['m2m_join_columns'] = [col1, col2] + res['m2m_join_table'] = table + for arg in ('string', 'readonly', 'states', 'size', 'group_operator', 'required', + 'change_default', 'translate', 'help', 'select', 'selectable', 'groups', + 'deprecated', 'digits', 'invisible', 'filters'): if getattr(field, arg, None): res[arg] = getattr(field, arg) - if field.string: - res['string'] = field.string - if field.help: - res['help'] = field.help - if hasattr(field, 'selection'): if isinstance(field.selection, (tuple, list)): res['selection'] = field.selection