← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-768241-pso into lp:openobject-addons

 

Priyesh (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-768241-pso into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-768241-pso/+merge/59481

Fixed bug: 768241 (https://bugs.launchpad.net/openobject-addons/+bug/768241)
Fixed problem of escaping % in text.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-768241-pso/+merge/59481
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-768241-pso.
=== modified file 'account_followup/account_followup.py'
--- account_followup/account_followup.py	2011-01-17 11:20:56 +0000
+++ account_followup/account_followup.py	2011-04-29 09:56:53 +0000
@@ -20,6 +20,9 @@
 ##############################################################################
 
 from osv import fields, osv
+import tools
+
+import re
 
 class followup(osv.osv):
     _name = 'account_followup.followup'
@@ -48,6 +51,19 @@
         'description': fields.text('Printed Message', translate=True),
     }
 
+    def _check_description(self, cr, uid, ids, context=None):
+        for line in self.browse(cr, uid, ids, context=context):
+            if not re.search('\d\s*\%\%', line.description):
+                return False
+            for desc_val in re.findall('\D\%(.*)s', line.description):
+                if tools.ustr(desc_val).encode('utf-8') not in ('(partner_name)', '(date)', '(user_signature)', '(company_name)'):
+                    return False
+        return True
+
+    _constraints = [
+        (_check_description, 'Either You are not giving proper words compatible with Legend or You are giving % without escape character', ['description']),
+    ]
+
 followup_line()
 
 class account_move_line(osv.osv):


Follow ups