|
@@ -11,14 +11,14 @@ openerp.print_engine = function (instance, local) {
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
var setup_socket = function (config) {
|
|
var setup_socket = function (config) {
|
|
- var protocol = window.location.protocol;
|
|
|
|
- self.socket = io(protocol + '//' + config.host + ':' + config.port, {
|
|
|
|
|
|
+ self.config = config;
|
|
|
|
+ self.socket = io(location.protocol + '//' + config.host + ':' + config.port, {
|
|
path: config.path
|
|
path: config.path
|
|
});
|
|
});
|
|
self.socket.on('connect', self.handle_connect);
|
|
self.socket.on('connect', self.handle_connect);
|
|
self.socket.on('connect_error', self.handle_connect_error);
|
|
self.socket.on('connect_error', self.handle_connect_error);
|
|
- self.socket.on('show-printers', self.handle_printers);
|
|
|
|
- self.socket.on('show-print-status', self.handle_print_status);
|
|
|
|
|
|
+ self.socket.on('request_printer_name', self.handle_printer_selection);
|
|
|
|
+ self.socket.on('show_print_status', self.handle_print_status);
|
|
}
|
|
}
|
|
|
|
|
|
this.get_socket_config().then(setup_socket);
|
|
this.get_socket_config().then(setup_socket);
|
|
@@ -31,7 +31,7 @@ openerp.print_engine = function (instance, local) {
|
|
$('#printer-status').removeClass();
|
|
$('#printer-status').removeClass();
|
|
$('#printer-status').addClass('printer-status-offline');
|
|
$('#printer-status').addClass('printer-status-offline');
|
|
},
|
|
},
|
|
- handle_printers: function (printers) {
|
|
|
|
|
|
+ handle_printer_selection: function (printers) {
|
|
instance.web.unblockUI();
|
|
instance.web.unblockUI();
|
|
|
|
|
|
var widget = new local.PrinterSelectionWidget(printers);
|
|
var widget = new local.PrinterSelectionWidget(printers);
|
|
@@ -77,11 +77,11 @@ openerp.print_engine = function (instance, local) {
|
|
instance.web.notification.do_warn('Impresión', 'La impresora no está preparada');
|
|
instance.web.notification.do_warn('Impresión', 'La impresora no está preparada');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
instance.web.blockUI();
|
|
instance.web.blockUI();
|
|
-
|
|
|
|
try {
|
|
try {
|
|
- this.socket.emit('request-print', {
|
|
|
|
|
|
+ this.socket.emit('request_print', {
|
|
|
|
+ print_direcly: this.config.print_direcly,
|
|
data: data
|
|
data: data
|
|
});
|
|
});
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -95,9 +95,6 @@ openerp.print_engine = function (instance, local) {
|
|
template: 'PrinterTopWidget',
|
|
template: 'PrinterTopWidget',
|
|
init: function (parent) {
|
|
init: function (parent) {
|
|
this._super(parent);
|
|
this._super(parent);
|
|
- },
|
|
|
|
- start: function () {
|
|
|
|
- // this.$el.click(this, this.selectDefaultPrinter);
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|