← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 724954] Re: [6.0.1] active_id in context attribute of act_window tag gets stored incorrectly [with fix]

 

Hi There

This is the trackback:

Traceback (most recent call last):
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/local/bin/openerp6/server/bin/osv/orm.py", line 973, in default_get
    defaults[f] = self._defaults[f](self, cr, uid, context)
  File "/usr/local/bin/openerp6/server/bin/addons/crm_jobs/crm_jobs.py", line 127, in _default_job_contact_id
    partner = self.pool.get('res.partner').browse(cr, uid, [context['partner_id']])
  File "/usr/local/bin/openerp6/server/bin/osv/orm.py", line 537, in browse
    return self._list_class([browse_record(cr, uid, id, self, cache, context=context, list_class=self._list_class, fields_process=fields_process) for id in select], context=context)
  File "/usr/local/bin/openerp6/server/bin/osv/orm.py", line 156, in __init__
    raise BrowseRecordError(_('Wrong ID for the browse record, got %r, expected an integer.') % (id,))
BrowseRecordError: Wrong ID for the browse record, got 'active_id', expected an integer.


I have a button on res.partner which launches an action thusly:

<act_window
            id="action_partner_job_task_new"
            name="New Task"
            res_model="job.task"
            src_model="res.partner"
            view_type="form"
            view_mode="form"
            context="{'partner_id' : active_id}" />

<button string="New Task" type="action"
name="%(action_partner_job_task_new)d" icon="gtk-new" />


It does seem wrong that active_id gets stored as a string, since it is supposed to be a variable that gets substituted by the client...

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/724954

Title:
  [6.0.1] active_id in context attribute of act_window tag gets stored
  incorrectly [with fix]

Status in OpenERP Server:
  Invalid

Bug description:
  For example, I have an act_window tag as follows:

          <act_window
              id="action_partner_job_task_new"
              name="New Task"
              res_model="job.task"
              src_model="res.partner"
              view_type="form"
              view_mode="form"
              context="{'partner_id' : active_id}" />

  Once this action is imported into the database, the value of 'context'
  in the ir_act_window table is:

  {'partner_id' : 'active_id'}

  The server has incorrectly converted the active_id variable into a
  string: 'active_id'. This causes errors in the web client when the
  action is linked from a button.

  The following patch resolves this issue:

  
  === modified file bin/tools/convert.py
  --- bin/tools/convert.py	2010-12-29 10:50:04 +0000
  +++ bin/tools/convert.py	2011-02-25 12:24:41 +0000
  @@ -459,7 +459,7 @@
               'limit': limit,
               'auto_refresh': auto_refresh,
               'uid' : uid,
  -            'active_id': active_id,
  +            #'active_id': active_id, # XXX Causes 'active_id' to be stored instead of active_id
               'ref' : ref,
           }
           context = self.get_context(data_node, rec, eval_context)



References