[IMP] fields.date.context_today: actually use the optional timestamp + better naming
- optional datetime was not being used - parameter renamed to timestamp to better indicate that it must be a datetime, not a simple date bzr revid: odo@openerp.com-20120214085044-unpa77hork25gtif
This commit is contained in:
parent
c4d9dfd8a9
commit
ed677bbfae
|
@ -273,14 +273,16 @@ class date(_column):
|
||||||
tools.DEFAULT_SERVER_DATE_FORMAT)
|
tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def context_today(cr, uid, today=None, context=None):
|
def context_today(cr, uid, timestamp=None, context=None):
|
||||||
"""Returns the current date as seen in the client's timezone
|
"""Returns the current date as seen in the client's timezone
|
||||||
in a format fit for date fields.
|
in a format fit for date fields.
|
||||||
This method may be passed as value to initialize _defaults.
|
This method may be passed as value to initialize _defaults.
|
||||||
|
|
||||||
:param datetime today: optional date value to use instead of
|
:param datetime timestamp: optional datetime value to use instead of
|
||||||
the current date"""
|
the current date and time (must be a
|
||||||
today = DT.datetime.now()
|
datetime, regular dates can't be converted
|
||||||
|
between timezones.)"""
|
||||||
|
today = timestamp or DT.datetime.now()
|
||||||
context_today = None
|
context_today = None
|
||||||
if context and context.get('tz'):
|
if context and context.get('tz'):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue