diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-09-05 15:28:22 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-09-05 15:28:22 +0200 |
| commit | 31bf30d2d0eb78baaa36360b99fe58bf7cd4c9e7 (patch) | |
| tree | d7be61ecd6bb4c8b5552e39b03e2a64eebbbf323 /openerp/tools/view_validation.py | |
| parent | afba9e8817c458640ae446ac7aaaab79be4fe1e9 (diff) | |
| parent | ed1c173971968eaa96693cb4e1547efa6e6c34e0 (diff) | |
[MERGE] forward port of branch 8.0 up to ed1c173
Diffstat (limited to 'openerp/tools/view_validation.py')
| -rw-r--r-- | openerp/tools/view_validation.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/openerp/tools/view_validation.py b/openerp/tools/view_validation.py index 9101d10064e..dc0a8d51830 100644 --- a/openerp/tools/view_validation.py +++ b/openerp/tools/view_validation.py @@ -11,9 +11,7 @@ def valid_page_in_book(arch): def valid_field_in_graph(arch): - """A `graph` must have `string` attribute and an immediate node of `graph` view must be `field`.""" - if arch.xpath('//graph[not (@string)]'): - return False + """ Children of ``graph`` can only be ``field`` """ for child in arch.xpath('/graph/child::*'): if child.tag != 'field': return False @@ -21,9 +19,7 @@ def valid_field_in_graph(arch): def valid_field_in_tree(arch): - """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 + """ Children of ``tree`` view must be ``field`` or ``button``.""" for child in arch.xpath('/tree/child::*'): if child.tag not in ('field', 'button'): return False @@ -31,13 +27,13 @@ def valid_field_in_tree(arch): def valid_att_in_field(arch): - """A `name` attribute must be in a `field` node.""" - return not arch.xpath('//field[not (@name)]') + """ ``field`` nodes must all have a ``@name`` """ + return not arch.xpath('//field[not(@name)]') def valid_att_in_label(arch): - """A `for` and `string` attribute must be on a `label` node.""" - return not arch.xpath('//label[not ((@for) or (@string))]') + """ ``label`` nodes must have a ``@for`` or a ``@string`` """ + return not arch.xpath('//label[not(@for or @string)]') def valid_att_in_form(arch): |
