Merge lp:~openerp-dev/openobject-server/6.0-opw-51026-skh into lp:openobject-server/6.0

Proposed by Somesh Khare
Status: Merged
Approved by: Olivier Laurent (Open ERP)
Approved revision: 3572
Merged at revision: 3584
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-51026-skh
Merge into: lp:openobject-server/6.0
Diff against target: 33 lines (+4/-5)
1 file modified
bin/osv/orm.py (+4/-5)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-51026-skh
Reviewer Review Type Date Requested Status
Olivier Laurent (Open ERP) (community) Needs Fixing
Naresh(OpenERP) (community) Approve
Review via email: mp+89831@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Olivier Laurent (Open ERP) (olt) wrote :

Hi Naresh,

runbot does not like the fix. I've reverted it.

A problem with null values.

The error message is:
  "null value in column "report_type" violates not-null constraint"

I can give you the complete log if you need it.

review: Needs Fixing
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

The proposal has been merged back to the server at revision-info:3584 <email address hidden> as the problem was from addons. a new fix is also applied at addons at revision-info:5056:<email address hidden>.

so changing the status to merged.

Regards,

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
767 done = {}767 done = {}
768 for i in range(len(fields)):768 for i in range(len(fields)):
769 res = False769 res = False
770 if not line[i]:
771 continue
772 if i >= len(line):770 if i >= len(line):
773 raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),))771 raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),))
774772
@@ -820,7 +818,7 @@
820 mode = False818 mode = False
821 else:819 else:
822 mode = field[len(prefix)+1]820 mode = field[len(prefix)+1]
823 res = _get_id(relation, line[i], current_module, mode)821 res = line[i] and _get_id(relation, line[i], current_module, mode) or False
824822
825 elif fields_def[field[len(prefix)]]['type']=='many2many':823 elif fields_def[field[len(prefix)]]['type']=='many2many':
826 relation = fields_def[field[len(prefix)]]['relation']824 relation = fields_def[field[len(prefix)]]['relation']
@@ -831,8 +829,9 @@
831829
832 # TODO: improve this by using csv.csv_reader830 # TODO: improve this by using csv.csv_reader
833 res = []831 res = []
834 for db_id in line[i].split(config.get('csv_internal_sep')):832 if line[i]:
835 res.append( _get_id(relation, db_id, current_module, mode) )833 for db_id in line[i].split(config.get('csv_internal_sep')):
834 res.append( _get_id(relation, db_id, current_module, mode) )
836 res = [(6,0,res)]835 res = [(6,0,res)]
837836
838 elif fields_def[field[len(prefix)]]['type'] == 'integer':837 elif fields_def[field[len(prefix)]]['type'] == 'integer':