[FIX] read_group: date format: use natural year along with month names, do not mix...
authorOlivier Dony <odo@openerp.com>
Mon, 13 Oct 2014 16:42:23 +0000 (18:42 +0200)
committerOlivier Dony <odo@openerp.com>
Mon, 13 Oct 2014 17:15:37 +0000 (19:15 +0200)
commitc0644a547444a5c33e5b9c7e2e55f7f45a2889b7
tree67b6af0cb6209c332e40d5a6b3b819a86619af70
parentc8e14f301f2ecdd8ff4ddbf032edddea323a3411
[FIX] read_group: date format: use natural year along with month names, do not mix with ISO week-year

The ISO week-year notation can produce confusing values
when the first week of the year is so short that it
becomes week 0 and is considered the last week of the
previous year, depending on the locale.

For instance, using ISO notation:
  'W53 2015' == dates.format_date(
      date(2015,1,1), format="'W'w YYYY", locale='en_GB')
  'W53 2005' == dates.format_date(
      date(2006,1,1), format="'W'w YYYY", locale='de_DE')

This is surprising but actually valid.

However it definitely yields wrong output when combined with
months formats:
  'January 2014' == dates.format_date(
      date(2015,1,1), format="MMMM YYYY", locale='en_GB')

As a result we must always use `y` to denote the year in
any date format, *except* when it is combined with the
week number `w`, in which case we must use `Y`.

See the documentation at:
   http://babel.pocoo.org/docs/dates/#date-fields
openerp/models.py