[IMP] tools: mail: improved html_email_clean
[odoo/odoo.git] / openerp / tools / view_validation.py
index e4324d1..9101d10 100644 (file)
@@ -11,7 +11,7 @@ def valid_page_in_book(arch):
 
 
 def valid_field_in_graph(arch):
-    """A `field` node must be below a `graph` node."""
+    """A `graph` must have `string` attribute and an immediate node of `graph` view must be `field`."""
     if arch.xpath('//graph[not (@string)]'):
         return False
     for child in arch.xpath('/graph/child::*'):
@@ -21,7 +21,7 @@ def valid_field_in_graph(arch):
 
 
 def valid_field_in_tree(arch):
-    """A `field` and `button` node must be below a `tree` node. And tree must have `string` attribute."""
+    """A `tree` must have `string` attribute and an immediate node of `tree` view must be `field` or `button`."""
     if arch.xpath('//tree[not (@string)]'):
         return False
     for child in arch.xpath('/tree/child::*'):
@@ -41,8 +41,7 @@ def valid_att_in_label(arch):
 
 
 def valid_att_in_form(arch):
-    """A `string` attribute must be on a `form` node."""
-    return not arch.xpath('//form[not (@string)]')
+    return True
 
 
 def valid_type_in_colspan(arch):
@@ -67,8 +66,8 @@ def valid_type_in_col(arch):
 
 def valid_view(arch):
     if arch.tag == 'form':
-        for pred in [valid_page_in_book, valid_att_in_form, valid_type_in_colspan,\
-                      valid_type_in_col, valid_att_in_field, valid_att_in_label]:
+        for pred in [valid_page_in_book, valid_att_in_form, valid_type_in_colspan,
+                     valid_type_in_col, valid_att_in_field, valid_att_in_label]:
             if not pred(arch):
                 _logger.error('Invalid XML: %s', pred.__doc__)
                 return False