Extend format_date function to allow a format other then the default
Sometimes when you create a report you have dates on it. To get the date right for the language you use format_date to get the date.
However if you want to have a portion of the date or want a different format then the default one, you can't.
Digging a bit deeper in the report.py I saw that format_date calls strftime in ir.lang. And that part actually accepts a format which is default None.
I propose to also extend the format_date function with the format=None so nothing breaks, but allows the user to add their own format.
So format_date (in report.py) WAS:
@classmethod
def format_date(cls, value, lang=None):
pool = Pool()
Lang = pool.get('ir.lang')
if lang is None:
lang = Lang.get()
return lang.strftime(value)
and BECOMES:
@classmethod
def format_date(cls, value, lang=None, format=None):
pool = Pool()
Lang = pool.get('ir.lang')
if lang is None:
lang = Lang.get()
return lang.strftime(value, format=format)