← Back to team overview

credativ team mailing list archive

[Bug 911133] Re: import_data - osv. Context object isn't passed when obj_model.search is called

 

The bug is only affected to trunk version so removing the tag and the
assignation.

Regards,

** Changed in: openobject-server
     Assignee: OpenERP Publisher's Warranty Team (openerp-opw) => (unassigned)

** Tags removed: maintenance

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

Title:
  import_data - osv.  Context object isn't passed when obj_model.search
  is called

Status in OpenERP Server:
  New

Bug description:
  If you are bulk importing historical data or master files and a
  records is linked to an inactive master file (res.partner,
  account.account) etc the row is rejected.

  You can set the property 'active_test' in the context object to false
  but the context object isn't passed through by the import function
  when a lookup is being done.

  Here is the fix to the problem (against trunk in the import_data
  function):

  bzr diff openerp/osv/orm.py:
  === modified file 'openerp/osv/orm.py'
  --- openerp/osv/orm.py  2011-12-01 12:15:03 +0000
  +++ openerp/osv/orm.py  2012-12-02 08:23:36 +0000
  @@ -1219,7 +1219,7 @@
               if mode=='.id':
                   id = int(id)
                   obj_model = self.pool.get(model_name)
  -                ids = obj_model.search(cr, uid, [('id', '=', int(id))])
  +                ids = obj_model.search(cr, uid, [('id', '=', int(id))], context=context)
                   if not len(ids):
                       raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))
               elif mode=='id':

  For example I am using the new OpenERP plugin in Kettle to load
  account.account records from an existing ERP.  I can only load active
  accounts since inactive accounts can't be referenced.  I will lose all
  historical data for those accounts if I can't link to them.

  Kind Regards,
  Pieter

  Edit: I see the patch isn't formed correctly, but i'm sure you can see
  that context=context needs to be added to the search function.

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


References