[ADD] wrapper to the modifiers setup process to simplify its call by third parties
bzr revid: xmo@openerp.com-20111006142727-spfj8foiln6m2jb9
This commit is contained in:
parent
5db16cd946
commit
65456808bc
|
@ -128,6 +128,32 @@ def transfer_modifiers_to_node(modifiers, node):
|
||||||
simplify_modifiers(modifiers)
|
simplify_modifiers(modifiers)
|
||||||
node.set('modifiers', simplejson.dumps(modifiers))
|
node.set('modifiers', simplejson.dumps(modifiers))
|
||||||
|
|
||||||
|
def setup_modifiers(node, field=None, context=None, in_tree_view=False):
|
||||||
|
""" Processes node attributes and field descriptors to generate
|
||||||
|
the ``modifiers`` node attribute and set it on the provided node.
|
||||||
|
|
||||||
|
Alters its first argument in-place.
|
||||||
|
|
||||||
|
:param node: ``field`` node from an OpenERP view
|
||||||
|
:type node: lxml.etree._Element
|
||||||
|
:param dict field: field descriptor corresponding to the provided node
|
||||||
|
:param dict context: execution context used to evaluate node attributes
|
||||||
|
:param bool in_tree_view: triggers the ``tree_invisible`` code
|
||||||
|
path (separate from ``invisible``): in
|
||||||
|
tree view there are two levels of
|
||||||
|
invisibility, cell content (a column is
|
||||||
|
present but the cell itself is not
|
||||||
|
displayed) with ``invisible`` and column
|
||||||
|
invisibility (the whole column is
|
||||||
|
hidden) with ``tree_invisible``.
|
||||||
|
:returns: nothing
|
||||||
|
"""
|
||||||
|
modifiers = {}
|
||||||
|
if field is not None:
|
||||||
|
transfer_field_to_modifiers(field, modifiers)
|
||||||
|
transfer_node_to_modifiers(
|
||||||
|
node, modifiers, context=context, in_tree_view=in_tree_view)
|
||||||
|
transfer_modifiers_to_node(modifiers, node)
|
||||||
|
|
||||||
def test_modifiers(what, expected):
|
def test_modifiers(what, expected):
|
||||||
modifiers = {}
|
modifiers = {}
|
||||||
|
|
Loading…
Reference in New Issue