Skip to content

Commit

Permalink
💚 eslint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yelizariev committed Feb 10, 2020
1 parent 70883cb commit f170e7b
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 59 deletions.
4 changes: 2 additions & 2 deletions pos_cashier_select/static/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ odoo.define('pos_choosing_cashier', function(require){
if (this.on_cashier_screen && (parsed_result.type !== 'cashier')) {
console.warn("Ignored Barcode Scan:", parsed_result);
return;
} else {
this._super(code);
}
this._super(code);

},
});

Expand Down
28 changes: 14 additions & 14 deletions pos_invoice_pay/static/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ models.PosModel = models.PosModel.extend({
get_sale_order_lines: function (ids) {
var self = this,
def = $.Deferred();
this.get_lines(ids, 'sale.order', 'get_order_lines_for_pos').
then(function (lines) {
this.get_lines(ids, 'sale.order', 'get_order_lines_for_pos')
.then(function (lines) {
var max = lines.length,
i = 0,
so_id = 0,
Expand Down Expand Up @@ -112,8 +112,8 @@ models.PosModel = models.PosModel.extend({
get_invoice_lines: function (data) {
var self = this,
def = $.Deferred();
this.get_lines(data, 'account.invoice', 'get_invoice_lines_for_pos').
then(function (lines) {
this.get_lines(data, 'account.invoice', 'get_invoice_lines_for_pos')
.then(function (lines) {
var inv = {},
inv_id = 0,
max = lines.length,
Expand Down Expand Up @@ -221,12 +221,12 @@ models.PosModel = models.PosModel.extend({
update_or_fetch_invoice: function (id) {
var self = this,
def = $.Deferred();
this.get_res('account.invoice', id).
then(function (res) {
this.get_res('account.invoice', id)
.then(function (res) {
self.prepare_invoices_data(res);
self.db.update_invoice_db(res[0]);
self.get_invoice_lines([res[0].id]).
then(function () {
self.get_invoice_lines([res[0].id])
.then(function () {
def.resolve(id);
});
});
Expand All @@ -236,12 +236,12 @@ models.PosModel = models.PosModel.extend({
update_or_fetch_sale_order: function (id) {
var def = $.Deferred(),
self = this;
this.get_res('sale.order', id).
then(function (res) {
this.get_res('sale.order', id)
.then(function (res) {
self.prepare_so_data(res);
self.db.update_so_db(res[0]);
self.get_sale_order_lines([res[0].id]).
then(function () {
self.get_sale_order_lines([res[0].id])
.then(function () {
def.resolve(id);
});
});
Expand Down Expand Up @@ -879,8 +879,8 @@ var InvoicesWidget = InvoicesAndOrdersBaseWidget.extend({
this.pos.selected_invoice = this.selected_invoice;
switch (this.selected_invoice.state) {
case "Draft":
this.pos.validate_invoice(this.selected_invoice.id).
then(function (id) {
this.pos.validate_invoice(this.selected_invoice.id)
.then(function (id) {
self.pos.update_or_fetch_invoice(id).then(function () {
self.render_data(self.pos.get_invoices_to_render(self.pos.db.invoices));
self.toggle_save_button();
Expand Down
10 changes: 6 additions & 4 deletions pos_keyboard/static/src/js/pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ odoo.define('pos_keyboard.pos', function (require) {
// KeyCode: Escape (Keypad 'esc')
var KC_ESCAPE = 27;
var kc_lookup = {
48: '0', 49: '1', 50: '2', 51: '3', 52: '4',
48: '0', 49: '1', 50: '2', 51: '3', 52: '4',
53: '5', 54: '6', 55: '7', 56: '8', 57: '9',
80: 'p', 83: 's', 68: 'd', 190: '.', 81: 'q',
96: '0', 97: '1', 98: '2', 99: '3', 100: '4',
96: '0', 97: '1', 98: '2', 99: '3', 100: '4',
101: '5', 102: '6', 103: '7', 104: '8', 105: '9',
106: '*', 107: '+', 109: '-', 110: '.', 111: '/'
};
Expand All @@ -246,7 +246,7 @@ odoo.define('pos_keyboard.pos', function (require) {
var ok = false;
var timeStamp = 0;
$('body').on('keyup', '', function (e){
var statusHandler = !rx.test(e.target.tagName) ||
var statusHandler = !rx.test(e.target.tagName) ||
e.target.disabled || e.target.readOnly;
// TODO: simplify that stuff/ it might be needed only for password pop-up
if (statusHandler){
Expand Down Expand Up @@ -303,7 +303,9 @@ odoo.define('pos_keyboard.pos', function (require) {
timeStamp = new Date().getTime();

setTimeout(function(){
if (ok) {self.action_callback(self.data);}
if (ok) {
self.action_callback(self.data);
}
}, 50);
}
});
Expand Down
2 changes: 0 additions & 2 deletions pos_longpolling/external_tests/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ e.g.
phantomjs http://pos.10.local/pos/web 025590b63e43f9efe53d0096c5affbe69ddfc092 60
Usage:
* Open browser dev tools, switch to Network tab
Expand All @@ -24,7 +23,6 @@ for i in `seq 100`; do /usr/local/bin/phantomjs run.js http://pos.10.local/pos/w
-- will run 100 instances for 300 seconds
*/

var system = require('system');
Expand Down
4 changes: 2 additions & 2 deletions pos_mobile/static/src/js/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ odoo.define('pos_mobile.screens', function (require) {
setTimeout(function(){
$('.order-scroller').getNiceScroll().resize();
$('.product-list-scroller').getNiceScroll().resize();
}, 300)
}, 300);
}
},
close_bottom_menu: function() {
Expand All @@ -102,7 +102,7 @@ odoo.define('pos_mobile.screens', function (require) {
setTimeout(function(){
$('.order-scroller').getNiceScroll().resize();
$('.product-list-scroller').getNiceScroll().resize();
}, 500)
}, 500);
}
},
change_categories_slide: function() {
Expand Down
24 changes: 14 additions & 10 deletions pos_multi_session/external_tests/phantomtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function waitForReady (page, ready, callback, timeout){
return page.evaluate(function (ready) {
var r = false;
try {
r = !!eval(ready);
r = Boolean(eval(ready));
} catch(ex) {
}
return r;
Expand Down Expand Up @@ -149,8 +149,9 @@ function PhantomTest() {
var page = self.page;

setTimeout(function () {
if (pagesLoaded)
return;
if (pagesLoaded) {
return;
}
page.evaluate(function (timeoutMessage) {
var message = timeoutMessage();
console.log('error', message);
Expand All @@ -171,7 +172,7 @@ function PhantomTest() {
src = v[1];
found = page.evaluate(function(code) {
try {
return !!eval(code);
return Boolean(eval(code));
} catch (e) {
return false;
}
Expand All @@ -189,7 +190,7 @@ function PhantomTest() {
};


})();
}());

}// for (var sname in self.options.sessions){

Expand Down Expand Up @@ -230,12 +231,14 @@ function PhantomTest() {
} else {
console.log(currentSName, currentPage.name, 'LOADED', url, status, JSON.stringify(currentPage.cookieJar.cookies));
// clear localstorage leftovers
currentPage.evaluate(function () {localStorage.clear(); });
currentPage.evaluate(function () {
localStorage.clear();
});
// process ready
waitForReady(currentPage, ready, onPageReady, session.timeout);
}
});
})(page, sname);
}(page, sname));
}//for (var sname in self.pages){

};
Expand Down Expand Up @@ -269,15 +272,16 @@ function PhantomTest() {
(function(){
var commandNum = i;
timer = setTimeout(function () {
if (commandNum != i)
return;
if (commandNum != i) {
return;
}
page.evaluate(function (tools) {
var message = tools.timeoutMessage();
console.log('error', message);
}, tools);
phantom.exit(1);
}, command.timeout || 60333);
})();
}());
if (extra == 'connection_off'){
console.log('Connection is off for', sname);
page.onResourceRequested = blockConnection;
Expand Down
9 changes: 5 additions & 4 deletions pos_multi_session/external_tests/tests/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ window.mstest = {
big_line = _.find(big.lines, function(line){
return line.name == small_line.name;
});
if (!big_line)
included = false;
else if (parseInt(big_line.qty) < parseInt(small_line.qty))
included = false;
if (!big_line) {
included = false;
} else if (parseInt(big_line.qty) < parseInt(small_line.qty)) {
included = false;
}
});
if (!included){
console.log('Small Order', JSON.stringify(small));
Expand Down
8 changes: 4 additions & 4 deletions pos_multi_session/static/src/js/pos_multi_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ odoo.define('pos_multi_session', function(require){
load_sync_all_request();
}, 2000);
});
}
};

load_sync_all_request();
});
Expand Down Expand Up @@ -241,7 +241,7 @@ odoo.define('pos_multi_session', function(require){
// there are two types of message construction, get_attr extract required data from either of them
var get_attr = function(obj, attr){
return obj[attr] || obj.data && obj.data[attr];
}
};
var same_session_check = get_attr(message, 'session_id') === this.pos_session.id;
var same_login_check = get_attr(message, 'login_number') === this.pos_session.login_number;
if (same_session_check &&
Expand Down Expand Up @@ -349,8 +349,8 @@ odoo.define('pos_multi_session', function(require){
var client = order.pos.db.get_partner_by_id(data.partner_id);
if(!client) {

$.when(this.load_new_partners_by_id(data.partner_id)).
then(function(new_client){
$.when(this.load_new_partners_by_id(data.partner_id))
.then(function(new_client){
new_client = order.pos.db.get_partner_by_id(data.partner_id);
order.set_client(new_client);
}, function(){
Expand Down
29 changes: 13 additions & 16 deletions pos_qr_scan/static/src/js/qr_scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ odoo.define('pos_qr_scan', function(require){
});
var active_camera_id = self.pos.db.load('active_camera_id', false);
if(active_camera_id && self.get_camera_by_id(active_camera_id)){
options = {'deviceId': {'exact':active_camera_id}}
options = {'deviceId': {'exact':active_camera_id}};
}
self.start_webcam(options);
});
}
catch(e){
} catch(e){
alert(e);
}
}
else{
} else{
console.log("no navigator.mediaDevices.enumerateDevices" );
this.start_webcam(options);
}
Expand All @@ -121,10 +119,10 @@ odoo.define('pos_qr_scan', function(require){
this.initCanvas(800, 600);
qrcode.callback = function(value){
self.read(value);
}
};
if(navigator.mediaDevices.getUserMedia){
navigator.mediaDevices.getUserMedia({video: options, audio: false}).
then(function(stream){
navigator.mediaDevices.getUserMedia({video: options, audio: false})
.then(function(stream){
self.stream = stream;
self.success(stream);
}).catch(function(error){
Expand Down Expand Up @@ -155,28 +153,27 @@ odoo.define('pos_qr_scan', function(require){
this.gUM=true;
},
captureToCanvas: function(){
if(!this.cam_is_on)
return;
if(!this.cam_is_on) {
return;
}
if(this.gUM){
var self = this;
try{
gCtx.drawImage(this.video_element,0,0);
try{
qrcode.decode();
}
catch(e){
} catch(e){
console.log(e);
setTimeout(function(){
self.captureToCanvas();
}, this.capture_timeout);
};
}
catch(e){
}
} catch(e){
console.log(e);
setTimeout(function(){
self.captureToCanvas();
}, this.capture_timeout);
};
}
}
},
initCanvas: function(w,h){
Expand Down
2 changes: 1 addition & 1 deletion pos_qr_show/static/src/js/pos_qr_show.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ odoo.define('pos_qr_show', function(require){
}, ""); // initial memory of ""

return rendered_html;
})
});
},
});

Expand Down

0 comments on commit f170e7b

Please sign in to comment.