[IMP] point_of_sale: let user send tracebacks by email
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -845,7 +845,10 @@
|
||||
Ok
|
||||
</div>
|
||||
<div class="button icon download">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
<i class="fa fa-download"></i>
|
||||
</div>
|
||||
<div class="button icon email">
|
||||
<i class="fa fa-paper-plane"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user