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
1=== modified file 'bin/osv/orm.py'
2--- bin/osv/orm.py 2012-01-12 11:09:04 +0000
3+++ bin/osv/orm.py 2012-01-24 06:40:29 +0000
4@@ -767,8 +767,6 @@
5 done = {}
6 for i in range(len(fields)):
7 res = False
8- if not line[i]:
9- continue
10 if i >= len(line):
11 raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),))
12
13@@ -820,7 +818,7 @@
14 mode = False
15 else:
16 mode = field[len(prefix)+1]
17- res = _get_id(relation, line[i], current_module, mode)
18+ res = line[i] and _get_id(relation, line[i], current_module, mode) or False
19
20 elif fields_def[field[len(prefix)]]['type']=='many2many':
21 relation = fields_def[field[len(prefix)]]['relation']
22@@ -831,8 +829,9 @@
23
24 # TODO: improve this by using csv.csv_reader
25 res = []
26- for db_id in line[i].split(config.get('csv_internal_sep')):
27- res.append( _get_id(relation, db_id, current_module, mode) )
28+ if line[i]:
29+ for db_id in line[i].split(config.get('csv_internal_sep')):
30+ res.append( _get_id(relation, db_id, current_module, mode) )
31 res = [(6,0,res)]
32
33 elif fields_def[field[len(prefix)]]['type'] == 'integer':