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
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2014-01-23 17:08:36 +0000
+++ addons/web/controllers/main.py 2014-02-10 09:11:00 +0000
@@ -1517,13 +1517,18 @@
1517 export = req.session.model("ir.exports").read([export_id])[0]1517 export = req.session.model("ir.exports").read([export_id])[0]
1518 export_fields_list = req.session.model("ir.exports.line").read(1518 export_fields_list = req.session.model("ir.exports.line").read(
1519 export['export_fields'])1519 export['export_fields'])
1520 def convert_field(f):
1521 field_name = f['name']
1522 if field_name.split('/') and field_name.split('/')[-1] == 'id':
1523 return '/'.join(field_name.split('/')[:-1])
1524 return field_name
15201525
1521 fields_data = self.fields_info(1526 fields_data = self.fields_info(
1522 req, model, map(operator.itemgetter('name'), export_fields_list))1527 req, model, map(convert_field, export_fields_list))
15231528
1524 return [1529 return [
1525 {'name': field_name, 'label': fields_data[field_name]}1530 {'name': field['name'], 'label': fields_data[field['name']]}
1526 for field_name in fields_data.keys()1531 for field in export_fields_list if field['name'] in fields_data
1527 ]1532 ]
15281533
1529 def fields_info(self, req, model, export_fields):1534 def fields_info(self, req, model, export_fields):
@@ -1571,8 +1576,10 @@
1571 subfields1576 subfields
1572 ))1577 ))
1573 elif base in fields:1578 elif base in fields:
1574 info[base] = fields[base]['string']1579 if 'relation' in fields[base]:
15751580 info[base+'/id'] = fields[base]['string']
1581 else :
1582 info[base] = fields[base]['string']
1576 return info1583 return info
15771584
1578 def graft_subfields(self, req, model, prefix, prefix_string, fields):1585 def graft_subfields(self, req, model, prefix, prefix_string, fields):
15791586
=== modified file 'addons/web/static/src/js/data_export.js'
--- addons/web/static/src/js/data_export.js 2013-05-30 10:04:20 +0000
+++ addons/web/static/src/js/data_export.js 2014-02-10 09:11:00 +0000
@@ -355,8 +355,9 @@
355 }355 }
356 },356 },
357 get_fields: function() {357 get_fields: function() {
358 var self = this;
358 var export_fields = this.$("#fields_list option").map(function() {359 var export_fields = this.$("#fields_list option").map(function() {
359 return $(this).val();360 return self.records[this.value] || $(this).val();
360 }).get();361 }).get();
361 if (!export_fields.length) {362 if (!export_fields.length) {
362 alert(_t("Please select fields to save export list..."));363 alert(_t("Please select fields to save export list..."));