3
0
Fork 0

[FIX] web_export_view: Several things:

* Compatibility with Werkzeug 0.9.3
* Export of first one2many field works again
* Parsing of float values
12.0
Stefan Rijnhart 2013-07-23 15:25:54 +02:00 committed by ernesto
parent 7c22f40bd3
commit 255a5792dc
2 changed files with 7 additions and 7 deletions

View File

@ -45,5 +45,5 @@ class ExcelExportView(ExcelExport):
% self.filename(model)), % self.filename(model)),
('Content-Type', self.content_type) ('Content-Type', self.content_type)
], ],
cookies={'fileToken': int(token)} cookies={'fileToken': token}
) )

View File

@ -37,9 +37,9 @@ openerp.web_export_view = function(instance, m) {
// or assume the main view is a list view and use that // or assume the main view is a list view and use that
var self = this, var self = this,
view = this.getParent(), view = this.getParent(),
columns = view.visible_columns; children = view.getChildren();
if (view.widget_children) { if (children) {
view.widget_children.every(function(child) { children.every(function(child) {
if (child.field && child.field.type == 'one2many') { if (child.field && child.field.type == 'one2many') {
view = child.viewmanager.views.list.controller; view = child.viewmanager.views.list.controller;
return false; // break out of the loop return false; // break out of the loop
@ -53,7 +53,7 @@ openerp.web_export_view = function(instance, m) {
} }
export_columns_keys = []; export_columns_keys = [];
export_columns_names = []; export_columns_names = [];
$.each(columns,function(){ $.each(view.visible_columns, function(){
if(this.tag=='field'){ if(this.tag=='field'){
// non-fields like `_group` or buttons // non-fields like `_group` or buttons
export_columns_keys.push(this.id); export_columns_keys.push(this.id);
@ -68,12 +68,12 @@ openerp.web_export_view = function(instance, m) {
if($row.attr('data-id')){ if($row.attr('data-id')){
export_row = []; export_row = [];
checked = $row.find('th input[type=checkbox]').attr("checked"); checked = $row.find('th input[type=checkbox]').attr("checked");
if (checked === "checked"){ if (children || checked === "checked"){
$.each(export_columns_keys,function(){ $.each(export_columns_keys,function(){
cell = $row.find('td[data-field="'+this+'"]').get(0); cell = $row.find('td[data-field="'+this+'"]').get(0);
text = cell.text || cell.textContent || cell.innerHTML || ""; text = cell.text || cell.textContent || cell.innerHTML || "";
if (cell.classList.contains("oe_list_field_float")){ if (cell.classList.contains("oe_list_field_float")){
export_row.push(parseFloat(text)); export_row.push(instance.web.parse_value(text, {'type': "float"}));
} }
else if (cell.classList.contains("oe_list_field_integer")){ else if (cell.classList.contains("oe_list_field_integer")){
export_row.push(parseInt(text)); export_row.push(parseInt(text));