diff --git a/doc/changelog.rst b/doc/changelog.rst index eadfe81b5e8..46f84364c76 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -6,6 +6,8 @@ Changelog `trunk` ------- +- Added support of custom group_by format and display format when using group_by + on a datetime field, using datetime_format context key - Improved ``html_email_clean`` in tools: better quote and signature finding, added shortening. - Cleaned and slightly refactored ``ir.actions.server``. The ``loop``, ``sms`` diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index f081e11b9e2..25ed8bdf861 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -2601,7 +2601,18 @@ class BaseModel(object): :param list groupby: fields by which the records will be grouped :param int offset: optional number of records to skip :param int limit: optional max number of records to return - :param dict context: context arguments, like lang, time zone + :param dict context: context arguments, like lang, time zone. A special + context key exist for datetime fields : ``datetime_format``. + context[``datetime_format``] = { + 'field_name': { + groupby_format: format for to_char (default: yyyy-mm) + display_format: format for displaying the value + in the result (default: MMM yyyy) + interval: day, month or year; used for begin + and end date of group_by intervals + computation (default: month) + } + } :param list orderby: optional ``order by`` specification, for overriding the natural sort ordering of the groups, see also :py:meth:`~osv.osv.osv.search`