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

Requested reviews:
  Mustufa Rangwala (Open ERP) (mra-tinyerp)
  Priyesh (OpenERP) (pso-openerp)
  qdp (OpenERP) (qdp)

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-05-10 13:55:57 +0000
+++ account_followup/account_followup.py	2011-07-14 12:28:59 +0000
@@ -20,6 +20,9 @@
 ##############################################################################
 
 from osv import fields, osv
+import tools
+
+import re
 
 class followup(osv.osv):
     _name = 'account_followup.followup'
@@ -33,7 +36,7 @@
     _defaults = {
         'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c),
     }
-    
+
     def check_company_uniq(self, cr, uid, ids, context=None):
         sr_id = self.search(cr,uid,[],context=context)
         lines = self.browse(cr, uid, sr_id, context=context)
@@ -65,6 +68,20 @@
         'start': 'days',
     }
 
+    def _check_description(self, cr, uid, ids, context=None):
+        for line in self.browse(cr, uid, ids, context=context):
+            for desc_vals in re.findall('\%\(\w*\)s', line.description):
+                for val in re.findall('\%(.*)s', desc_vals):
+                    if tools.ustr(val).encode('utf-8') not in ('(partner_name)', '(date)', '(user_signature)', '(company_name)'):
+                        return False
+            if re.findall('\\\\%*', line.name) or len(re.findall('\)', line.name)) != len(re.findall('\(', line.name)) or re.findall('\%+[a-z]|\%+[A-Z]|\%+[0-9]', line.name) or re.findall('[a-z]+\%|[A-Z]+\%|[0-9]+\%', line.name):
+                return False
+        return True
+
+    _constraints = [
+        (_check_description, 'Either description does not contain proper legends or contains % without escape character', ['description']),
+    ]
+
 followup_line()
 
 class account_move_line(osv.osv):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to