[REF] pos_epson_printer: migration to OWL framework
This commit is contained in:
committed by
Pierre Masereel
parent
e773761d10
commit
f87838046c
@@ -2,7 +2,6 @@ odoo.define('pos_epson_printer.pos_epson_printer', function (require) {
|
||||
"use strict";
|
||||
|
||||
var models = require('point_of_sale.models');
|
||||
var PaymentScreenWidget = require('point_of_sale.screens').PaymentScreenWidget;
|
||||
var EpsonPrinter = require('pos_epson_printer.Printer');
|
||||
|
||||
var posmodel_super = models.PosModel.prototype;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
odoo.define('pos_epson_printer.Printer', function (require) {
|
||||
"use strict";
|
||||
|
||||
const { Gui } = require('point_of_sale.Gui');
|
||||
var core = require('web.core');
|
||||
var PrinterMixin = require('point_of_sale.Printer').PrinterMixin;
|
||||
|
||||
@@ -17,14 +18,13 @@ var EpsonPrinter = core.Class.extend(PrinterMixin, {
|
||||
},
|
||||
|
||||
callback_connect: function (resultConnect) {
|
||||
var self = this;
|
||||
var deviceId = 'local_printer';
|
||||
var options = {'crypto' : false, 'buffer' : false};
|
||||
if ((resultConnect == 'OK') || (resultConnect == 'SSL_CONNECT_OK')) {
|
||||
this.ePOSDevice.createDevice(deviceId, this.ePOSDevice.DEVICE_TYPE_PRINTER, options, this.callback_createDevice.bind(this));
|
||||
} else {
|
||||
this.pos.chrome.ready.then(function () {
|
||||
self.pos.gui.show_popup('error', {
|
||||
Gui.showPopup('ErrorPopup', {
|
||||
'title': _t('Connection to the printer failed'),
|
||||
'body': _t('Please check if the printer is still connected, if the configured IP address is correct and if your printer supports the ePOS protocol.'),
|
||||
});
|
||||
@@ -33,9 +33,8 @@ var EpsonPrinter = core.Class.extend(PrinterMixin, {
|
||||
},
|
||||
|
||||
callback_createDevice: function (deviceObj, errorCode) {
|
||||
var self = this;
|
||||
if (deviceObj === null) {
|
||||
this.pos.gui.show_popup('error', {
|
||||
Gui.showPopup('ErrorPopup', {
|
||||
'title': _t('Connection to the printer failed'),
|
||||
'body': _t('Please check if the printer is still connected. Error code: ') + errorCode,
|
||||
});
|
||||
@@ -44,7 +43,7 @@ var EpsonPrinter = core.Class.extend(PrinterMixin, {
|
||||
this.printer = deviceObj;
|
||||
this.printer.onreceive = function(response){
|
||||
if (!response.success) {
|
||||
self.pos.gui.show_popup('error', {
|
||||
Gui.showPopup('ErrorPopup', {
|
||||
'title': _t('Epson ePOS Error'),
|
||||
'body': _t('An error happened while sending data to the printer. Error code: ') + response.code,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user