Merge lp:~elbati/enapps-csv-import-tool/allowing_regexp_replace_by_empty_string 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/allowing_regexp_replace_by_empty_string
Merge into: lp:~enapps-london-uk/enapps-csv-import-tool/old_trunk
Diff against target: 18 lines (+2/-2)
1 file modified
ea_import/ea_import_template_line_regexp_field.py (+2/-2)
To merge this branch: bzr merge lp:~elbati/enapps-csv-import-tool/allowing_regexp_replace_by_empty_string
Reviewer Review Type Date Requested Status
Enapps Ltd OpenERP Partner London UK Pending
Review via email: mp+140243@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Unmerged revisions

11. By Lorenzo Battistini

[FIX] removing fix contained by this https://code.launchpad.net/~elbati/enapps-csv-import-tool/fix-get_related_id/+merge/125226 yet

10. By Lorenzo Battistini

[FIX] allowing regexp replace by empty string

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_line_regexp_field.py'
2--- ea_import/ea_import_template_line_regexp_field.py 2012-05-28 12:49:58 +0000
3+++ ea_import/ea_import_template_line_regexp_field.py 2012-12-17 17:40:29 +0000
4@@ -49,14 +49,14 @@
5 =================
6 result - "ENAPPS LTD is an awesome and cool British company"
7 '''),
8- 'replace_by': fields.char('Replace by', size=512, required=True, ),
9+ 'replace_by': fields.char('Replace by', size=512, required=False, ),
10 }
11
12 def replace_string(self, cr, uid, ids, target_string, context={}):
13 for regexp_field in self.browse(cr, uid, ids, context=context):
14 search_result = re.search(regexp_field.regexp, target_string)
15 if search_result:
16- return re.sub(regexp_field.regexp, regexp_field.replace_by, target_string)
17+ return re.sub(regexp_field.regexp, regexp_field.replace_by or '', target_string)
18 return target_string
19
20

Subscribers

People subscribed via source and target branches