openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #17044
[Bug 1001634] Re: Errors in followup template translations silently fail
Hello Saurang, did you also try with a translated template ?
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1001634
Title:
Errors in followup template translations silently fail
Status in OpenERP Addons (modules):
Confirmed
Bug description:
Hi,
Here is an easy improvement for account_followup that could save hours for some people:
If someone configures a followup message with a parsing error, for
example by including 'Dear % (partner_name)s,' instead of 'Dear
%(partner_name)s', then the message creation silently fails :
(Pdb)
> /home/dadafkas/projets/anybox/buildout/parts/openerp-6.1-1/openerp/addons/account_followup/report/account_followup_print.py(117)_get_text()
-> 'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature or '',
ValueError: "unsupported format character '(' (0x28) at index 7"
The consequence is that the followup report is printed anyway, but
without any message :(
The easy fix is to enclose the string formatting in a try: except:,
and replace the message with a prominent warning in case the
formatting fails :
if text:
try:
text = text % {
'partner_name': stat_line.partner_id.name,
'date': time.strftime('%Y-%m-%d'),
'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 '',
}
except:
text = 'WARNING!!! ERROR IN FOLLOWUP MESSAGE TEMPLATE. Please fix you followup configuration: \n%r' % text
return text
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1001634/+subscriptions
References