diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 3526883e45e..546a232ef3d 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1814,15 +1814,20 @@ class Reports(View): report = zlib.decompress(report) report_mimetype = self.TYPES_MAPPING.get( report_struct['format'], 'octet-stream') + file_name = None if 'name' not in action: reports = req.session.model('ir.actions.report.xml') - res_id = reports.search([('report_name', '=',action['report_name']),], + res_id = reports.search([('report_name', '=', action['report_name']),], 0, False, False, context) - action['name'] = reports.read(res_id, ['name'], context)[0]['name'] + if len(res_id) > 0: + file_name = reports.read(res_id[0], ['name'], context)['name'] + else: + file_name = action['report_name'] return req.make_response(report, headers=[ - ('Content-Disposition', 'attachment; filename="%s.%s"' % (action['name'], report_struct['format'])), + # maybe we should take of what characters can appear in a file name? + ('Content-Disposition', 'attachment; filename="%s.%s"' % (file_name, report_struct['format'])), ('Content-Type', report_mimetype), ('Content-Length', len(report))], cookies={'fileToken': int(token)}) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 16141ce7be5..556e7fe73b3 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -472,6 +472,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return self.on_processed_onchange(response, processed); } catch(e) { + console.error(e); instance.webclient.crashmanager.on_javascript_exception(e); return $.Deferred().reject(); } @@ -509,6 +510,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } if (result.domain) { function edit_domain(node) { + if (typeof node !== "object") { + return; + } var new_domain = result.domain[node.attrs.name]; if (new_domain) { node.attrs.domain = new_domain; @@ -520,6 +524,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.Deferred().resolve(); } catch(e) { console.error(e); + instance.webclient.crashmanager.on_javascript_exception(e); return $.Deferred().reject(); } }, @@ -552,6 +557,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM on_button_cancel: function(event) { if (this.can_be_discarded()) { this.set({mode: "view"}); + this.on_record_loaded(this.datarecord); } return false; }, @@ -2023,6 +2029,7 @@ instance.web.DateTimeWidget = instance.web.OldWidget.extend({ this.$input_picker = this.$element.find('input.oe_datepicker_container'); this.$input.change(this.on_change); this.picker({ + onClose: this.on_picker_select, onSelect: this.on_picker_select, changeMonth: true, changeYear: true,