Browse Source

💚 pre-commit: auto cleanups

pull/155/head
Ivan Yelizariev 5 years ago
committed by Vincent Van Rossem
parent
commit
16129ba1cb
  1. 4
      pos_keyboard/__manifest__.py
  2. 2
      pos_keyboard/data.xml
  3. 8
      pos_keyboard/doc/index.rst
  4. 12
      pos_keyboard/static/src/js/pos.js
  5. 11
      pos_keyboard/tests/test_pos_keyboard.py

4
pos_keyboard/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015 igallyamov <https://github.com/igallyamov> # Copyright 2015 igallyamov <https://github.com/igallyamov>
# Copyright 2016 ufaks <https://github.com/ufaks> # Copyright 2016 ufaks <https://github.com/ufaks>
# Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
@ -11,13 +10,14 @@
"category": "Point Of Sale", "category": "Point Of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version={ODOO_BRANCH}", # "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version={ODOO_BRANCH}",
"images": ['images/keyboard.png'], "images": ['images/keyboard.png'],
"version": "10.0.1.1.5",
"version": "11.0.1.1.5",
"application": False, "application": False,
"author": "IT-Projects LLC, Ivan Yelizariev", "author": "IT-Projects LLC, Ivan Yelizariev",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",
"website": "https://it-projects.info/team/yelizariev", "website": "https://it-projects.info/team/yelizariev",
"license": "LGPL-3", "license": "LGPL-3",
"price": 15.00, "price": 15.00,
"currency": "EUR", "currency": "EUR",

2
pos_keyboard/data.xml

@ -16,5 +16,5 @@
<script type="text/javascript" src="/pos_keyboard/static/src/js/test_pos_keyboard.js"></script> <script type="text/javascript" src="/pos_keyboard/static/src/js/test_pos_keyboard.js"></script>
</xpath> </xpath>
</template> </template>
</openerp> </openerp>

8
pos_keyboard/doc/index.rst

@ -37,7 +37,7 @@ Backspace ``<-`` delete symbol
----------- --------------------- ------------------ ----------- --------------------- ------------------
Enter ``Ok`` confirmation Enter ``Ok`` confirmation
----------- --------------------- ------------------ ----------- --------------------- ------------------
Esc ``Cancel`` close Pop-up
Esc ``Cancel`` close Pop-up
=========== ===================== ================== =========== ===================== ==================
User Scenario User Scenario
@ -49,12 +49,12 @@ User Scenario
* You can use ``Backspace`` if you want to delete symbol * You can use ``Backspace`` if you want to delete symbol
* You can use ``Enter`` if you want to confirm PIN code * You can use ``Enter`` if you want to confirm PIN code
* You can use ``Esc`` if you want to close the Pop-up keyboard * You can use ``Esc`` if you want to close the Pop-up keyboard
* Work in your own account using hotkeys for each mode on the Numpad or just press Extra keys. Then enter numbers. * Work in your own account using hotkeys for each mode on the Numpad or just press Extra keys. Then enter numbers.
* You can use ``/`` or ``q`` in case of Qrt mode * You can use ``/`` or ``q`` in case of Qrt mode
* You can use ``-`` or ``d`` in case of Disc mode * You can use ``-`` or ``d`` in case of Disc mode
* You can use ``*`` or ``p`` in case of Price mode * You can use ``*`` or ``p`` in case of Price mode
* You can use ``+`` or ``s`` in case of +/-
* You can use ``+`` or ``s`` in case of +/-
RESULT: In opened POS Keyboard support is invoked instantly and available for further work without any extra action. RESULT: In opened POS Keyboard support is invoked instantly and available for further work without any extra action.

12
pos_keyboard/static/src/js/pos.js

@ -104,7 +104,7 @@ odoo.define('pos_keyboard.pos', function (require) {
} }
} }
}); });
screens.PaymentScreenWidget.include({ screens.PaymentScreenWidget.include({
show: function(){ show: function(){
this._super(); this._super();
@ -115,8 +115,8 @@ odoo.define('pos_keyboard.pos', function (require) {
this.pos.keypad.connect(); this.pos.keypad.connect();
} }
}); });
// this module mimics a keypad-only cash register. Use connect() and
// this module mimics a keypad-only cash register. Use connect() and
// disconnect() to activate and deactivate it. // disconnect() to activate and deactivate it.
var Keypad = core.Class.extend({ var Keypad = core.Class.extend({
init: function(attributes){ init: function(attributes){
@ -248,7 +248,7 @@ odoo.define('pos_keyboard.pos', function (require) {
self.data.type = undefined; self.data.type = undefined;
self.data.val = undefined; self.data.val = undefined;
ok = false; ok = false;
}
}
if (is_number) { if (is_number) {
if (timeStamp + 50 > new Date().getTime()) { if (timeStamp + 50 > new Date().getTime()) {
@ -266,13 +266,13 @@ odoo.define('pos_keyboard.pos', function (require) {
self.active = true; self.active = true;
}, },
// stops catching keyboard events
// stops catching keyboard events
disconnect: function(){ disconnect: function(){
$('body').off('keyup', ''); $('body').off('keyup', '');
self.active = false; self.active = false;
} }
}); });
return { return {
Keypad: Keypad Keypad: Keypad
}; };

11
pos_keyboard/tests/test_pos_keyboard.py

@ -8,11 +8,12 @@ import odoo.tests
@odoo.tests.common.at_install(True) @odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True) @odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase): class TestUi(odoo.tests.HttpCase):
def test_pos_keyboard(self): def test_pos_keyboard(self):
# without a delay there might be problems on the steps whilst opening a POS # without a delay there might be problems on the steps whilst opening a POS
# caused by a not yet loaded button's action # caused by a not yet loaded button's action
self.phantom_js("/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('pos_keyboard_tour', 500)",
"odoo.__DEBUG__.services['web_tour.tour'].tours.pos_keyboard_tour.ready",
login="admin")
self.phantom_js(
"/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('pos_keyboard_tour', 500)",
"odoo.__DEBUG__.services['web_tour.tour'].tours.pos_keyboard_tour.ready",
login="admin",
)
Loading…
Cancel
Save