[FIX] account_followup: formatted user language date in followup text

When using %(date)s in the follow-up text in the follow-up levels configuration
the date was formatted within server date format
instead of the partner language date format.

Closes https://github.com/odoo/odoo/pull/5168
This commit is contained in:
Julien Laloux 2015-02-10 15:23:25 +01:00 committed by Denis Ledoux
parent c718661ba8
commit 368c674a9b
1 changed files with 4 additions and 1 deletions

View File

@ -103,9 +103,12 @@ class report_rappel(report_sxw.rml_parse):
partner_max_text = i.followup_line_id.description
text = partner_max_delay and partner_max_text or default_text
if text:
lang_obj = self.pool['res.lang']
lang_ids = lang_obj.search(self.cr, self.uid, [('code', '=', stat_line.partner_id.lang)], context=context)
date_format = lang_ids and lang_obj.browse(self.cr, self.uid, lang_ids[0], context=context).date_format or '%Y-%m-%d'
text = text % {
'partner_name': stat_line.partner_id.name,
'date': time.strftime('%Y-%m-%d'),
'date': time.strftime(date_format),
'company_name': stat_line.company_id.name,
'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature or '',
}