Skip to content
Permalink
Browse files

Merge pull request #1058 from fedoranvar/11.0-pos_logout-tour

🛡, pos_logout
  • Loading branch information...
itpp-bot committed Aug 9, 2019
2 parents 1006fc3 + 3c53812 commit a8a788e439c9ff1c3b46f7bfd0f43095ee0ab100
Showing with 80 additions and 23 deletions.
  1. +5 −3 pos_logout/README.rst
  2. +63 −19 pos_logout/static/src/js/tour.js
  3. +12 −1 pos_logout/tests/test_default.py
@@ -9,7 +9,9 @@ Credits

Contributors
------------
* `Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>`__
* `Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar>`__
* `Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>`__
* `Kildebekov Anvar <https://it-projects.info/team/kildebekov>`__

Sponsors
--------
@@ -19,7 +21,7 @@ Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/10.0/pos_qr_login/>`__.
To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/pos_qr_login/>`__.

Thank you for understanding!

@@ -36,4 +38,4 @@ Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Tested on Odoo 11.0 a63ecee47ac271b1f0a23528d9d5eab7f63ae528
Tested on Odoo 11.0 dff2e242a5e5288cb3c8408a9b635a4c85034e83
@@ -1,41 +1,76 @@
/* Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
* Copyright 2019 Kildebekov Anvar <https://it-projects.info/team/kildebekov>
* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */

odoo.define('pos_logout.tour', function(require) {
"use strict";

var tour = require('web_tour.tour');

var steps = [{
function pos_opening(){
return [{
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"], .oe_menu_toggler[data-menu-xmlid="point_of_sale.menu_point_root"]',
content: "Ready to launch your <b>point of sale</b>? <i>Click here</i>.",
}, {
trigger: ".o_pos_kanban button.oe_kanban_action_button",
content: "<p>Click to start the point of sale interface. It <b>runs on tablets</b>, laptops, or industrial hardware.</p><p>Once the session launched, the system continues to run without an internet connection.</p>",
}];

steps = steps.concat([{
trigger: '.o_main_content:has(.loader:hidden)',
content: 'waiting for loading to finish',
timeout: 20000,
run: function () {
// it's a check
},
}, {
content: "Switch to table or make dummy action",
trigger: '.table:not(.oe_invisible .neworder-button), .order-button.selected',
}, {
trigger: '.o_main_content:has(.loader:hidden)',
content: 'waiting for loading to finish',
timeout: 20000,
run: function () {
// it's a check
},
}, {
content: "Switch to table or make dummy action",
trigger: '.table:not(.oe_invisible .neworder-button), .order-button.selected',
}];
}

function password_prompt(cashier,password){
return [{
trigger: '.pos-branding .username',
content: 'Open Cashier popup',
}, {
trigger: '.popup .exit',
content: 'Block POS Screen',
}, {
trigger: '.popups .block',
content: 'Click for unblock the screen',
content: 'Click to unlock the screen',
}, {
trigger: '.modal-dialog:visible .selection-item:contains(' + cashier + ')',
content: 'Change current cashier to tour-cashier',
}, {
trigger: 'div.button.cancel',
content: 'Cancel password-prompt',
}, {
trigger: '.popups .block',
content: 'Click to unlock the screen',
}, {
trigger: '.modal-dialog:visible .selection-item:contains(' + cashier + ')',
content: 'Change current cashier to tour-cashier',
}, {
trigger: 'div.button.confirm',
content: 'Confirm empty (incorrect) password',
}, {
trigger: 'div.popup.popup-error div.button.cancel',
content: 'Close error popup',
}, {
trigger: 'div.button.confirm',
content: 'Input password',
run: function(){
for (var i = 0; i < password.length; i++) {
$('div.popup.popup-number.popup-password div.popup-numpad button.input-button.number-char:contains(' + password.charAt(i) + ')').click();
}
},
}, {
trigger: '.modal-dialog:visible .selection-item:contains("Administrator")',
content: 'Change current cashier',
}]);
trigger: 'div.button.confirm',
content: 'confirm password',
}];
}

steps = steps.concat([{
function pos_closing(){
return [{
trigger: ".header-button",
content: "close the Point of Sale frontend",
}, {
@@ -47,7 +82,16 @@ odoo.define('pos_logout.tour', function(require) {
run: function () {
// no need to click on trigger
},
}]);
}];
}

var steps = [];
var username = "test";
var userpassword = "0000";
steps = steps.concat(pos_opening());
steps = steps.concat(password_prompt(username,userpassword));
steps = steps.concat(pos_closing());


tour.register('pos_logout_tour', {test: true, url: '/web' }, steps);
});
@@ -1,3 +1,7 @@
# Copyright 2018 Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar>
# Copyright 2019 Kildebekov Anvar <https://it-projects.info/team/kildebekov>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

import odoo.tests
from odoo.api import Environment

@@ -12,12 +16,19 @@ def test_01_pos_is_loaded(self):
assert cr == self.registry.test_cr
env = Environment(cr, self.uid, {})

# From https://github.com/odoo/odoo/blob/11.0/addons/point_of_sale/tests/test_frontend.py#L292-L297
# From https://github.com/odoo/odoo/blob/48dafd5b2011cee966920f664a904de2e2715ae8/addons/point_of_sale/tests/test_frontend.py#L306-L310
#
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.

env['res.users'].create({
'name': "test",
'login': "test",
'password': "test",
'pos_security_pin': "0000",
})
env['ir.module.module'].search([('name', '=', 'pos_logout')], limit=1).state = 'installed'
self.registry.test_cr.release()

0 comments on commit a8a788e

Please sign in to comment.
You can’t perform that action at this time.