From bd31b7c55354d4a3aa9b8eba95a80844449fdfe6 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 26 Sep 2012 15:09:42 +0200 Subject: [PATCH 1/2] [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 From add6b7b08a3d47d0b369cbcaa83e610a1f8d66e1 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 26 Sep 2012 15:10:06 +0200 Subject: [PATCH 2/2] [IMP] res.partner: explicitly deprecate `address` and `country` columns bzr revid: odo@openerp.com-20120926131006-b3mzn9y38rkg7e1s --- openerp/addons/base/res/res_partner.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index 008e8048a5d..fe749c6013b 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -199,7 +199,10 @@ class res_partner(osv.osv, format_address): 'bank_ids': fields.one2many('res.partner.bank', 'partner_id', 'Banks'), 'website': fields.char('Website', size=64, help="Website of Partner or Company"), 'comment': fields.text('Notes'), - 'address': fields.one2many('res.partner.address', 'partner_id', 'Contacts'), # should be removed in version 7, but kept until then for backward compatibility + 'address': fields.one2many('res.partner.address', 'partner_id', 'Addresses', + deprecated="The address information is now directly stored on each Partner record. "\ + "Multiple contacts with their own address can be added via the child_ids relationship. "\ + "This field will be removed as of OpenERP 7.1."), 'category_id': fields.many2many('res.partner.category', id1='partner_id', id2='category_id', string='Tags'), 'credit_limit': fields.float(string='Credit Limit'), 'ean13': fields.char('EAN13', size=13), @@ -218,7 +221,8 @@ class res_partner(osv.osv, format_address): 'city': fields.char('City', size=128), 'state_id': fields.many2one("res.country.state", 'State'), 'country_id': fields.many2one('res.country', 'Country'), - 'country': fields.related('country_id', type='many2one', relation='res.country', string='Country'), # for backward compatibility + 'country': fields.related('country_id', type='many2one', relation='res.country', string='Country', + deprecated="This field will be removed as of OpenERP 7.1, use country_id instead"), 'email': fields.char('Email', size=240), 'phone': fields.char('Phone', size=64), 'fax': fields.char('Fax', size=64),