Merged
authorHDA (OpenERP) <hda@tinyerp.com>
Tue, 6 Apr 2010 06:38:37 +0000 (12:08 +0530)
committerHDA (OpenERP) <hda@tinyerp.com>
Tue, 6 Apr 2010 06:38:37 +0000 (12:08 +0530)
bzr revid: hda@tinyerp.com-20100406063837-sli3uyy3fsnx6dji

1  2 
bin/osv/orm.py

diff --cc bin/osv/orm.py
@@@ -1933,30 -1878,9 +1933,31 @@@ class orm(orm_template)
      _protected = ['read','write','create','default_get','perm_read','unlink','fields_get','fields_view_get','search','name_get','distinct_field_get','name_search','copy','import_data','search_count', 'exists']
  
      def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
 +        """
 +        Get the list of records in list view sorted by the given fields
 +
 +        :param cr: database cursor
 +        :param uid: current user id
 +        :param domain: a list specifying search criteria [['field_name', 'operator', 'value'], ...]
 +        :param fields: a list of fields present in the list view specified on the object
 +        :param groupby: a list of fields on which to sort the records
 +        :type fields_list: a list (example ['field_name_1', ...])
 +        :param offset: optional number of records to skip
 +        :param limit: optional max number of records to return
 +        :param context: context arguments, like lang, time zone
 +        :return: a list of dictionaries(one dictionary for each record) containing:
 +
 +                    * the values of fields sorted out by the fields in groupby arguement
 +                    * __domain: a list of tuples specifying the search criteria
 +                    * __context: a dictionary with argument like 'groupby'
 +        :rtype: [{'field_name_1': value, ...]
 +        :raise AccessError: * if user has no read rights on the requested object
 +                            * if user tries to bypass access rules for read on the requested object
 +
 +        """
          groupby_list = groupby
-         groupby = groupby[0]
+         if isinstance(groupby, list):
+             groupby = groupby[0]
          context = context or {}
          self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context)
          if not fields: