[REM] models: remove _all_columns

This commit is contained in:
Raphael Collet
2016-08-31 17:21:45 +02:00
parent 6eca5d038f
commit ff5e44d2de
3 changed files with 1 additions and 58 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class MailMail(models.Model):
def default_get(self, fields):
# protection for `default_type` values leaking from menu action context (e.g. for invoices)
# To remove when automatic context propagation is removed in web client
if self._context.get('default_type') not in self._all_columns['message_type'].column.selection:
if self._context.get('default_type') not in type(self).message_type.base_field.selection:
self = self.with_context(dict(self._context, default_type=None))
return super(MailMail, self).default_get(fields)
-14
View File
@@ -2987,20 +2987,6 @@ class BaseModel(object):
for name, source in parent._inherit_fields.iteritems():
struct[name] = (parent_model, parent_field, source[2], source[3])
@property
def _all_columns(self):
""" Returns a dict mapping all fields names (self fields and inherited
field via _inherits) to a ``column_info`` object giving detailed column
information. This property is deprecated, use ``_fields`` instead.
"""
result = {}
# do not inverse for loops, since local fields may hide inherited ones!
for k, (parent, m2o, col, original_parent) in self._inherit_fields.iteritems():
result[k] = fields.column_info(k, col, parent, m2o, original_parent)
for k, col in self._columns.iteritems():
result[k] = fields.column_info(k, col)
return result
@api.model
def _inherits_check(self):
for table, field_name in self._inherits.items():
-43
View File
@@ -1814,46 +1814,3 @@ class property(function):
fnct_search=self._property_search,
**args
)
class column_info(object):
""" Struct containing details about an osv column, either one local to
its model, or one inherited via _inherits.
.. attribute:: name
name of the column
.. attribute:: column
column instance, subclass of :class:`_column`
.. attribute:: parent_model
if the column is inherited, name of the model that contains it,
``None`` for local columns.
.. attribute:: parent_column
the name of the column containing the m2o relationship to the
parent model that contains this column, ``None`` for local columns.
.. attribute:: original_parent
if the column is inherited, name of the original parent model that
contains it i.e in case of multilevel inheritance, ``None`` for
local columns.
"""
__slots__ = ['name', 'column', 'parent_model', 'parent_column', 'original_parent']
def __init__(self, name, column, parent_model=None, parent_column=None, original_parent=None):
self.name = name
self.column = column
self.parent_model = parent_model
self.parent_column = parent_column
self.original_parent = original_parent
def __str__(self):
return '%s(%s, %s, %s, %s, %s)' % (
self.__class__.__name__, self.name, self.column,
self.parent_model, self.parent_column, self.original_parent)