diff options
| author | Denis Ledoux <dle@odoo.com> | 2017-03-03 16:34:46 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2017-03-08 12:52:10 +0100 |
| commit | 8428910a741277d4f3afa1b09cb2042b7b58bc58 (patch) | |
| tree | cefe5b0f67d950ccc83ccddcaf4b5cf187832e33 | |
| parent | 629d80c3c2f6e3050e18ff966e7ee0b04612575f (diff) | |
[FIX] mail: format_date with falsy date
If the date passed is falsy, return
an empty string instead of crashing.
opw-704260
| -rw-r--r-- | addons/mail/models/mail_template.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index 3bfbf636a89..200057f8449 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -20,6 +20,8 @@ _logger = logging.getLogger(__name__) def format_date(pool, cr, uid, date, pattern=False, context=None): + if not date: + return '' date = datetime.datetime.strptime(date[:10], openerp.tools.DEFAULT_SERVER_DATE_FORMAT) lang_code = context.get('lang') or 'en_US' if not pattern: |
