[MERGE] 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-20120926162638-ftfbvflfa525q0lg
This commit is contained in:
@@ -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),
|
||||
|
||||
+5
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user