openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #11634
[Bug 1001634] Re: Errors in followup templates silently fail
Hello Christophe,
I have checked your Issue and code, but I think you might have a misunderstand something..
When someone configures with mistake like : 'Dear % (partner_name)s,'. then at the time of save ,raised the error : "Error occurred while validating the field(s) description: Your description is invalid, use the right legend or %% if you want to use the percent character".
So now no chance to made mistake. That's why I have attached the video. would you please check it and notify us where you have faced the problem.
Thank you and waiting for your reply!
** Attachment added: "account_followup.ogv"
https://bugs.launchpad.net/openobject-addons/+bug/1001634/+attachment/3155863/+files/account_followup.ogv
** Changed in: openobject-addons
Status: New => Incomplete
--
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 templates silently fail
Status in OpenERP Addons (modules):
Incomplete
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