[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)
|
||||
|
||||
@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
|
||||
in a format fit for date fields.
|
||||
This method may be passed as value to initialize _defaults.
|
||||
|
||||
:param datetime today: optional date value to use instead of
|
||||
the current date"""
|
||||
today = DT.datetime.now()
|
||||
:param datetime timestamp: optional datetime value to use instead of
|
||||
the current date and time (must be a
|
||||
datetime, regular dates can't be converted
|
||||
between timezones.)"""
|
||||
today = timestamp or DT.datetime.now()
|
||||
context_today = None
|
||||
if context and context.get('tz'):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue