Merge lp:~elbati/enapps-csv-import-tool/fix-get_related_id into lp:~enapps-london-uk/enapps-csv-import-tool/old_trunk

Proposed by Lorenzo Battistini
Status: Needs review
Proposed branch: lp:~elbati/enapps-csv-import-tool/fix-get_related_id
Merge into: lp:~enapps-london-uk/enapps-csv-import-tool/old_trunk
Diff against target: 25 lines (+4/-0)
2 files modified
ea_import/ea_import_template.py (+2/-0)
ea_import/ea_import_template_line.py (+2/-0)
To merge this branch: bzr merge lp:~elbati/enapps-csv-import-tool/fix-get_related_id
Reviewer Review Type Date Requested Status
Enapps Ltd OpenERP Partner London UK Approve
Review via email: mp+125226@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Enapps Ltd OpenERP Partner London UK (enapps-london-uk) wrote :

Nice :)

review: Approve
Revision history for this message
Lorenzo Battistini (elbati) wrote :
10. By Lorenzo Battistini

[FIX] many2one_rel_type == 'template' too

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Unmerged revisions

10. By Lorenzo Battistini

[FIX] many2one_rel_type == 'template' too

9. By Lorenzo Battistini

[FIX] also, when csv field is empty, we should not check the 'update_current'

8. By Lorenzo Battistini

[FIX] when importing m2o by template,
if csv field is empty, the get_related_id method should not return the list of every record for current model.
This happens when key=[], so
    self.low_level_search(cr, uid, [template.id], key, context=context)
returns the list of all records

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ea_import/ea_import_template.py'
2--- ea_import/ea_import_template.py 2012-09-06 08:51:17 +0000
3+++ ea_import/ea_import_template.py 2012-12-18 08:14:20 +0000
4@@ -82,6 +82,8 @@
5 value = template_line.get_field(input_list, testing=True)
6 if value:
7 key.append((field_name, '=', value))
8+ if not key:
9+ return [None]
10 if template.update_current:
11 key.append(('create_date', '>', context['time_of_start']))
12 result = self.low_level_search(cr, uid, [template.id], key, context=context)
13
14=== modified file 'ea_import/ea_import_template_line.py'
15--- ea_import/ea_import_template_line.py 2012-09-06 09:17:30 +0000
16+++ ea_import/ea_import_template_line.py 2012-12-18 08:14:20 +0000
17@@ -222,6 +222,8 @@
18 result = template_line.related_template_id.get_related_id(input_list)
19 if testing:
20 test_many2one_result(result, template_line, target_string)
21+ if not result:
22+ return None
23 return result[0]
24 else:
25 continue

Subscribers

People subscribed via source and target branches