Somesh Khare(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.0-opw-51026-skh into 
lp:openobject-server/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-51026-skh/+merge/89831

Hello Sir,

Import a blank record using csv does not makes effect on the record (field). 

Scenario:
If you try to import product record using CSV and the CSV has a record as 
blank( ex: default_code ="") and .id = "any existing DB id", the record 
imported successfully but with any effect on the reference field(default_code 
field). The field will not replaced with blank.

Expected behavior:

Record should be modified with the blank.

Kindly review the branch and please share your views.

Thanks,
Somesh Khare
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-51026-skh/+merge/89831
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.0-opw-51026-skh.
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py	2012-01-12 11:09:04 +0000
+++ bin/osv/orm.py	2012-01-24 06:40:29 +0000
@@ -767,8 +767,6 @@
             done = {}
             for i in range(len(fields)):
                 res = False
-                if not line[i]:
-                    continue
                 if i >= len(line):
                     raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),))
 
@@ -820,7 +818,7 @@
                         mode = False
                     else:
                         mode = field[len(prefix)+1]
-                    res = _get_id(relation, line[i], current_module, mode)
+                    res = line[i] and _get_id(relation, line[i], current_module, mode) or False
 
                 elif fields_def[field[len(prefix)]]['type']=='many2many':
                     relation = fields_def[field[len(prefix)]]['relation']
@@ -831,8 +829,9 @@
 
                     # TODO: improve this by using csv.csv_reader
                     res = []
-                    for db_id in line[i].split(config.get('csv_internal_sep')):
-                        res.append( _get_id(relation, db_id, current_module, mode) )
+                    if line[i]:
+                        for db_id in line[i].split(config.get('csv_internal_sep')):
+                            res.append( _get_id(relation, db_id, current_module, mode) )
                     res = [(6,0,res)]
 
                 elif fields_def[field[len(prefix)]]['type'] == 'integer':

_______________________________________________
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