'fields_get([fields][, attributes])
Return the definition of each field.
The returned value is a dictionary (indiced by field name) of
dictionaries. The _inherits\'d fields are included. The string, help,
and selection (if present) attributes are translated.
:param allfields: list of fields to document, all if empty or not provided
:param attributes: list of description attributes to return for each field, all if empty or not provided'

@api.model
def fields_get(self, allfields=None, attributes=None):

    has_access = functools.partial(self.check_access_rights, raise_exception=False)
    readonly = (not (has_access('write') or has_access('create')))
    res = {}
    for (fname, field) in self._fields.iteritems():
        if (allfields and (fname not in allfields)):
            continue
        if (field.groups and (not self.user_has_groups(field.groups))):
            continue
        description = field.get_description(self.env)
        if readonly:
            description['readonly'] = True
            description['states'] = {}
        if attributes:
            description = {key: val for (key, val) in description.iteritems() if (key in attributes)}
        res[fname] = description
    return res
