diff --git a/addons/point_of_sale/static/src/js/gui.js b/addons/point_of_sale/static/src/js/gui.js index 48021560642..a996b85c649 100644 --- a/addons/point_of_sale/static/src/js/gui.js +++ b/addons/point_of_sale/static/src/js/gui.js @@ -305,6 +305,7 @@ var Gui = core.Class.extend({ // file named 'name' // if 'contents' is not a string, it is converted into // a JSON representation of the contents. + download_file: function(contents, name) { var URL = window.URL || window.webkitURL; @@ -323,6 +324,18 @@ var Gui = core.Class.extend({ }).get(0).dispatchEvent(evt); }, + /* ---- Gui: EMAILS ---- */ + + // This will launch the user's email software + // with a new email with the address, subject and body + // prefilled. + + send_email: function(address, subject, body) { + window.open("mailto:" + address + + "?subject=" + (subject ? window.encodeURIComponent(subject) : '') + + "&body=" + (body ? window.encodeURIComponent(body) : '')); + }, + /* ---- Gui: KEYBOARD INPUT ---- */ // This is a helper to handle numpad keyboard input. diff --git a/addons/point_of_sale/static/src/js/popups.js b/addons/point_of_sale/static/src/js/popups.js index 28de1df98f5..1a28061a931 100644 --- a/addons/point_of_sale/static/src/js/popups.js +++ b/addons/point_of_sale/static/src/js/popups.js @@ -8,6 +8,7 @@ odoo.define('point_of_sale.popups', function (require) { var PosBaseWidget = require('point_of_sale.BaseWidget'); var gui = require('point_of_sale.gui'); +var _t = require('web.core')._t; var PopupWidget = PosBaseWidget.extend({ @@ -102,9 +103,16 @@ var ErrorTracebackPopupWidget = ErrorPopupWidget.extend({ show: function(opts) { var self = this; this._super(opts); + this.$('.download').off('click').click(function(){ self.gui.download_file(self.options.body,'traceback.txt'); }); + + this.$('.email').off('click').click(function(){ + self.gui.send_email( self.pos.company.email, + _t('IMPORTANT: Bug Report From Odoo Point Of Sale'), + self.options.body); + }); } }); gui.define_popup({name:'error-traceback', widget: ErrorTracebackPopupWidget}); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 7e35f4411a8..5f898f15e34 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -845,7 +845,10 @@ Ok
+