[IMP] base: simplify code from b3feb2358c
This commit is contained in:
+1
-7
@@ -3,7 +3,7 @@
|
||||
|
||||
""" High-level objects for fields. """
|
||||
|
||||
from collections import OrderedDict, defaultdict, namedtuple
|
||||
from collections import OrderedDict, defaultdict
|
||||
from datetime import date, datetime
|
||||
from functools import partial
|
||||
from operator import attrgetter
|
||||
@@ -2070,12 +2070,6 @@ class Id(Field):
|
||||
def __set__(self, record, value):
|
||||
raise TypeError("field 'id' cannot be assigned")
|
||||
|
||||
# null object for fields, extend as necessary for use in context
|
||||
MissingField = namedtuple('MissingField', 'group_operator')
|
||||
missing_field = MissingField(
|
||||
group_operator=None,
|
||||
)
|
||||
|
||||
# imported here to avoid dependency cycle issues
|
||||
from openerp import SUPERUSER_ID
|
||||
from .exceptions import AccessError, MissingError
|
||||
|
||||
+3
-2
@@ -2103,7 +2103,8 @@ class BaseModel(object):
|
||||
f for f in fields
|
||||
if f != 'sequence'
|
||||
if f not in groupby_fields
|
||||
if self._fields.get(f, missing_field).group_operator
|
||||
if f in self._fields
|
||||
if self._fields[f].group_operator
|
||||
if getattr(self._fields[f].base_field.column, '_classic_write', False)
|
||||
]
|
||||
|
||||
@@ -6248,4 +6249,4 @@ def _normalize_ids(arg, atoms=set(IdType)):
|
||||
|
||||
# keep those imports here to avoid dependency cycle errors
|
||||
from .osv import expression
|
||||
from .fields import Field, SpecialValue, FailedValue, missing_field
|
||||
from .fields import Field, SpecialValue, FailedValue
|
||||
|
||||
Reference in New Issue
Block a user