[MERGE] [IMP] fields: date, datetime: added MONTHS variable holding list of (month_number, month_name) + [DOC] updated changelog

This allows to remove the definition of MONTHS that appear in several addons, notably in reporting. Addons branches will come that use this new attribute

bzr revid: tde@openerp.com-20130719081834-dhiwl13vxd5fmbrr
This commit is contained in:
Thibault Delavallée 2013-07-19 10:18:34 +02:00
commit 67ac805e51
2 changed files with 33 additions and 0 deletions

View File

@ -6,6 +6,8 @@ Changelog
`trunk`
-------
- Added MONTHS attribute on fields.date and fields.datetime, holding the list
(month_number, month_name)
- Almost removed ``LocalService()``. For reports,
``openerp.osv.orm.Model.print_report()`` can be used. For workflows, see
:ref:`orm-workflows`.

View File

@ -270,6 +270,21 @@ class float(_column):
class date(_column):
_type = 'date'
MONTHS = [
('01', 'January'),
('02', 'February'),
('03', 'March'),
('04', 'April'),
('05', 'May'),
('06', 'June'),
('07', 'July'),
('08', 'August'),
('09', 'September'),
('10', 'October'),
('11', 'November'),
('12', 'December')
]
@staticmethod
def today(*args):
""" Returns the current date in a format fit for being a
@ -319,6 +334,22 @@ class date(_column):
class datetime(_column):
_type = 'datetime'
MONTHS = [
('01', 'January'),
('02', 'February'),
('03', 'March'),
('04', 'April'),
('05', 'May'),
('06', 'June'),
('07', 'July'),
('08', 'August'),
('09', 'September'),
('10', 'October'),
('11', 'November'),
('12', 'December')
]
@staticmethod
def now(*args):
""" Returns the current datetime in a format fit for being a