Valencia Rodrigues (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.0-opw-50559-vro into 
lp:openobject-server/6.0.

Requested reviews:
  Olivier (Open ERP) (olt)
  nel (nel-tinyerp)
  Vinay Rana (openerp) (vra-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-50559-vro/+merge/83287

Hello,

Currently, one cannot update inactive records via import (case ref:50559). To 
regenerate the issue please follow the steps below:

1. Deactivate a product from Sales > Products > Products.
2. From the list view, apply a filter to search for the inactive product.
3. Export this record to a CSV file with the fields Database ID, Active and 
Name.
4. Change the Name of the product in the CSV file and attempt to import the 
changes.

The following traceback is encountered:

Environment Information : 
System : Linux-2.6.32-35-generic-i686-with-Ubuntu-10.04-lucid
OS Name : posix
LSB Version:    
core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 10.04.3 LTS
Release:        10.04
Codename:       lucid
Operating System Release : 2.6.32-35-generic
Operating System Version : #78-Ubuntu SMP Tue Oct 11 15:27:15 UTC 2011
Operating System Architecture : 32bit
Operating System Locale : en_IN.ISO8859-1
Python Version : 2.6.5
OpenERP-Client Version : 6.0.3
Last revision No. & ID :1914 
launchpad_translations_on_behalf_of_openerp-20111119054707-8r5h65cf6eef789o
Traceback (most recent call last):
  File "/home/tiny/workspace/6.0/openobject-server/bin/netsvc.py", line 489, in 
dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, 
params)
  File 
"/home/tiny/workspace/6.0/openobject-server/bin/service/web_services.py", line 
599, in dispatch
    res = fn(db, uid, *params)
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/osv.py", line 122, 
in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/osv.py", line 176, 
in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/osv.py", line 167, 
in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/orm.py", line 871, 
in import_data
    process_liness(self, datas, [], current_module, self._name, fields_def, 
position=position)
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/orm.py", line 790, 
in process_liness
    data_res_id = _get_id(model_name, line[i], current_module, '.id')
  File "/home/tiny/workspace/6.0/openobject-server/bin/osv/orm.py", line 729, 
in _get_id
    raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))
Exception: Database ID doesn't exist: product.product : 45

The import_datas method uses _get_id(), which in turn employs search(). By 
default, search() fetches only active records.

This fix permits the search for inactive records in _get_id to fix the issue.

Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-50559-vro/+merge/83287
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.0-opw-50559-vro.
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py	2011-09-30 12:22:46 +0000
+++ bin/osv/orm.py	2011-11-24 13:19:52 +0000
@@ -723,7 +723,7 @@
             if mode=='.id':
                 id = int(id)
                 obj_model = self.pool.get(model_name)
-                ids = obj_model.search(cr, uid, [('id', '=', int(id))], context=context)
+                ids = obj_model.search(cr, uid, [('id', '=', int(id)),('active','in',['True','False'])], context=context)
                 if not len(ids):
                     raise Exception(_("Database ID doesn't exist: %s : %s") %(model_name, id))
             elif mode=='id':

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to