Merge lp:~openerp-dev/openerp-web/7.0-opw-603113-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-603113-msh
Merge into: lp:openerp-web/7.0
Diff against target: 53 lines (+14/-6)
2 files modified
addons/web/controllers/main.py (+12/-5)
addons/web/static/src/js/data_export.js (+2/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-603113-msh
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Xavier (Open ERP) Pending
Martin Trigaux (OpenERP) Pending
Review via email: mp+203745@code.launchpad.net

Description of the change

Hello,

Export using saved field list gives wrong header for relational fields, which creates problem while import same exported file.

Demo: Go to any view say for example Sale Order and then just select any record and then open Export dialog, select some fields which are kind of relational field and then just Export to file.

Now without closing dialog save those fields, close the dialog and re-open export dialog, from saved list open fields list which just saved and then export data to file.

Now compare label of the header for both files, file which we created using Saved field list will not have /id for relational field, if header are without /id in relational field then it may create issue while importing the same file.

Thanks.

To post a comment you must log in.
4128. By Martin Trigaux (OpenERP)

[FIX] attachement: display error message (removed inexistant template) and redraw the window (to avoid getting stucked)

4129. By Martin Trigaux (OpenERP)

[IMP] attachement: remove unnecessary redraw added at rev 4128 and change message to be the same than in mail

4130. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4131. By jke-openerp

[MERGE] Merge with 7.0-fix-css-clearfix-jke - bug clearfix on oe_title and oe_form_group

4132. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4133. By Martin Trigaux (OpenERP)

[FIX] css: remove height: 18px on .oe_facet_value property to avoid long filter name to exceed the size of the box (on 2 lines)

4134. By Martin Trigaux (OpenERP)

[MERGE] [FIX] search: make sure search view is not destroyed when starting SearchView widget
This avoids getting the error 'Cannot call method 'getParent' of undefined'

4135. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4136. By Martin Trigaux (OpenERP)

[IMP] reference fields: display a more user-friendly window title when open a chosen many2one record in reference field

4137. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Web Export: Refixed the issue of Export using saved field list gives wrong header for relational fields, which creates problem while import same exported file, also fixed the issue of fields order changed in saved fields due to revision 4115.

Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

Along with issue of saved fields returning field's header wrong also fixed the issue of saved fields changes the order of the fields while re-fetching saved field list.

Demo: Export in any view -> select some fields and Save field list anf then reload that saved field list, check order of the saved field list has been changed, this does not create any block issue but while exporting order of the field is important because sometimes export is going to be matched with another system's data.

Thanks.

Unmerged revisions

4137. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Web Export: Refixed the issue of Export using saved field list gives wrong header for relational fields, which creates problem while import same exported file, also fixed the issue of fields order changed in saved fields due to revision 4115.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/controllers/main.py'
2--- addons/web/controllers/main.py 2014-01-23 17:08:36 +0000
3+++ addons/web/controllers/main.py 2014-02-10 09:11:00 +0000
4@@ -1517,13 +1517,18 @@
5 export = req.session.model("ir.exports").read([export_id])[0]
6 export_fields_list = req.session.model("ir.exports.line").read(
7 export['export_fields'])
8+ def convert_field(f):
9+ field_name = f['name']
10+ if field_name.split('/') and field_name.split('/')[-1] == 'id':
11+ return '/'.join(field_name.split('/')[:-1])
12+ return field_name
13
14 fields_data = self.fields_info(
15- req, model, map(operator.itemgetter('name'), export_fields_list))
16+ req, model, map(convert_field, export_fields_list))
17
18 return [
19- {'name': field_name, 'label': fields_data[field_name]}
20- for field_name in fields_data.keys()
21+ {'name': field['name'], 'label': fields_data[field['name']]}
22+ for field in export_fields_list if field['name'] in fields_data
23 ]
24
25 def fields_info(self, req, model, export_fields):
26@@ -1571,8 +1576,10 @@
27 subfields
28 ))
29 elif base in fields:
30- info[base] = fields[base]['string']
31-
32+ if 'relation' in fields[base]:
33+ info[base+'/id'] = fields[base]['string']
34+ else :
35+ info[base] = fields[base]['string']
36 return info
37
38 def graft_subfields(self, req, model, prefix, prefix_string, fields):
39
40=== modified file 'addons/web/static/src/js/data_export.js'
41--- addons/web/static/src/js/data_export.js 2013-05-30 10:04:20 +0000
42+++ addons/web/static/src/js/data_export.js 2014-02-10 09:11:00 +0000
43@@ -355,8 +355,9 @@
44 }
45 },
46 get_fields: function() {
47+ var self = this;
48 var export_fields = this.$("#fields_list option").map(function() {
49- return $(this).val();
50+ return self.records[this.value] || $(this).val();
51 }).get();
52 if (!export_fields.length) {
53 alert(_t("Please select fields to save export list..."));