← Back to team overview

openerp-india team mailing list archive

[Bug 932713] [NEW] Use context values in attrs

 

Public bug reported:

Hi!

I would like to use values from the context in an "attrs" attribute, say
something like:

attrs="{invisible:[('user','!=',uid)]}"

Unfortunately it does not seem to work like that. However, it seems to
me it could be enabled really easily by modifying the
'transfer_node_to_modifiers' function in orm.py, assigning the
'locals_dict'argument of the eval to the 'context' dictionary, like
that:

def transfer_node_to_modifiers(node, modifiers, context=None, in_tree_view=False):
    if node.get('attrs'):
        modifiers.update(eval(node.get('attrs'),locals_dict=context))

Cheers!

** Affects: openobject-server
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/932713

Title:
  Use context values in attrs

Status in OpenERP Server:
  New

Bug description:
  Hi!

  I would like to use values from the context in an "attrs" attribute,
  say something like:

  attrs="{invisible:[('user','!=',uid)]}"

  Unfortunately it does not seem to work like that. However, it seems to
  me it could be enabled really easily by modifying the
  'transfer_node_to_modifiers' function in orm.py, assigning the
  'locals_dict'argument of the eval to the 'context' dictionary, like
  that:

  def transfer_node_to_modifiers(node, modifiers, context=None, in_tree_view=False):
      if node.get('attrs'):
          modifiers.update(eval(node.get('attrs'),locals_dict=context))

  Cheers!

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/932713/+subscriptions


Follow ups

References