Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] pos_logout #1378

Draft
wants to merge 3 commits into
base: 14.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions pos_logout/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. image:: https://itpp.dev/images/infinity-readme.png
:alt: Tested and maintained by IT Projects Labs
:target: https://itpp.dev

=================
Lock POS Screen
=================

Automatically lock pos on inactivity

Questions?
==========

To get an assistance on this module contact us by email :arrow_right: [email protected]

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

===================

Odoo Apps Store: https://apps.odoo.com/apps/modules/13.0/pos_logout/


Tested on `Odoo 13.0 <https://github.com/odoo/odoo/commit/2d46a08a989f4c7e005ee2ead7c342c72019e63f>`_
3 changes: 3 additions & 0 deletions pos_logout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License MIT (https://opensource.org/licenses/MIT).

from . import models
31 changes: 31 additions & 0 deletions pos_logout/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
# Copyright 2017-2018 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2020 Almas Giniatullin <https://it-projects.info/team/almas50>
# Copyright 2021 Denis Mudarisov <https://github.com/trojikman>
# License MIT (https://opensource.org/licenses/MIT).
{
"name": """Lock POS Screen""",
"summary": """Automatically lock pos on inactivity""",
"category": "Point of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/pos-logout?version=13.0",
"images": ["images/pos_logout_main.png"],
"version": "14.0.2.0.0",
"application": False,
"author": "IT-Projects LLC, Dinar Gabbasov",
"support": "[email protected]",
"website": "https://github.com/itpp-labs/pos-addons#readme",
"license": "Other OSI approved licence", # MIT
"price": 20.00,
"currency": "EUR",
"depends": ["point_of_sale"],
"external_dependencies": {"python": [], "bin": []},
"data": ["views/pos_logout.xml"],
"qweb": ["static/src/xml/pos.xml"],
"demo": [],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"auto_install": False,
"installable": True,
}
9 changes: 9 additions & 0 deletions pos_logout/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
`2.0.0`
-------

**Improvement:** removed `pos_pin` dependency due to existing functionality

`1.0.0`
-------

- Init version
48 changes: 48 additions & 0 deletions pos_logout/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
=================
Lock POS Screen
=================

Installation
============

* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way

Configuration
=============

* Open menu ``[[ Point of Sale ]] >> Configuration >> Point of Sale``
* Choose the POS where you need the ability to lock the screen
* Enable `Login with Employees` and set `Allowed Employees` or you can leave this field blank

Setting auto-locking interval
-----------------------------

The last activity interval to activate the automatic screen lock. Zero if auto-locking is not needed

* Open menu ``[[ Point of Sale ]] >> Configuration >> Point of Sale``

* Open POS configuration form
* Click ``[Edit]``
* Input in **Screen Auto-lock** a number of seconds before auto-locking. Zero if auto-locking is not needed
* Click ``[Save]``

Setting **Badge ID** and/or **Security PIN** for login the POS
--------------------------------------------------------------

* Go to ``Employees``

* Open user form
* Open **HR Settings** tab
* Set **Badge ID** and/or **Security PIN**

Usage
=====

The last activity interval to activate the automatic screen lock. Zero if autolocking is not needed

* Open menu ``[[ Point of Sale ]] >> Configuration >> Point of Sale``

* Open POS configuration form
* Click ``[Edit]``
* Input in **Autolock** a number of seconds before autolocking. Zero if autolocking is not needed
* Click ``[Save]``
38 changes: 38 additions & 0 deletions pos_logout/i18n/pos_logout.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_logout
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: pos_logout
#: model:ir.model,name:pos_logout.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""

#. module: pos_logout
#: model:ir.model.fields,field_description:pos_logout.field_pos_config__logout_interval
msgid "Screen Autolock"
msgstr ""

#. module: pos_logout
#. openerp-web
#: code:addons/pos_logout/static/src/xml/pos.xml:18
#, python-format
msgid "Tap to unlock..."
msgstr ""

#. module: pos_logout
#: model:ir.model.fields,help:pos_logout.field_pos_config__logout_interval
#: model_terms:ir.ui.view,arch_db:pos_logout.view_pos_config_form
msgid "The last activity interval to activate the automatic screen lock. Zero if autolocking is not needed"
msgstr ""

Binary file added pos_logout/images/pos_logout_main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pos_logout/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License MIT (https://opensource.org/licenses/MIT).

from . import logout_config
14 changes: 14 additions & 0 deletions pos_logout/models/logout_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License MIT (https://opensource.org/licenses/MIT).

from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

logout_interval = fields.Integer(
string="Screen Auto-lock",
default=0,
help="The last activity interval to activate the automatic screen lock. Zero if autolocking is not needed",
)
Binary file added pos_logout/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions pos_logout/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan" style="color:#875A7B;">Lock POS Screen</h2>
<h3 class="oe_slogan">Automatic logout by a set timer</h3>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p class="oe_mt32">
<div class="alert alert-info" style="padding:0.3em 0.6em; font-size: 150%;">
<i class="fa fa-hand-o-right"></i><b> Key features: </b>
<ul class="list-unstyled">
<li>
<i class="fa fa-check-square-o text-primary"></i>
Set auto-lock time
</li>
</ul>
</div>
</p>
</div>
</div>
</section>

<br/>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span8">
<h2>Need our service?</h2>
<p class="oe_mt32">Contact us by <a href="mailto:[email protected]">email</a></p>
<ul>
<li><a href="mailto:[email protected]">[email protected] <i class="fa fa-envelope-o"></i></a></li>
</ul>
</div>
<div class="oe_span4">
<div class="stamp" style="width:200px;">
<div style="margin-top: 15px;
position: relative;
font-family:'Vollkorn', serif;
font-size: 16px;
line-height: 25px;
text-transform: uppercase;
font-weight: bold;
color: #75526b;
border: 3px dashed #75526b;
float: left;
padding: 4px 12px;
-webkit-transform: rotate(-6deg);
-o-transform: rotate(-6deg);
-moz-transform: rotate(-6deg);
-ms-transform: rotate(-6deg);">
Tested on Odoo<br/>13.0 community
</div>
<div style="margin-top: 15px;
position: relative;
font-family:'Vollkorn', serif;
font-size: 16px;
line-height: 25px;
text-transform: uppercase;
font-weight: bold;
color: #75526b;
border: 3px dashed #75526b;
float: left;
padding: 4px 12px;
-webkit-transform: rotate(-7deg);
-o-transform: rotate(-7deg);
-moz-transform: rotate(-7deg);
-ms-transform: rotate(-7deg);">
Tested on Odoo<br/>13.0 enterprise
</div>
</div>
</div>
</div>
</section>
25 changes: 25 additions & 0 deletions pos_logout/static/src/css/pos_logout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.pos .popup-selection .exit {
position: absolute;
right: 0px;
top: 0;
padding: 15px;
cursor: pointer;
font-size: 30px;
}
.pos .modal-dialog.block {
background-color: rgba(85, 0, 0, 0.5);
cursor: pointer;
}
.pos .modal-dialog.block .popup-selection {
background-color: initial;
box-shadow: none;
height: 250px;
color: black;
font-size: 65px;
}
.pos .modal-dialog.block .popup-selection p {
margin: 0;
}
.pos .modal-dialog.block .popup-selection i {
font-size: 150px;
}
33 changes: 33 additions & 0 deletions pos_logout/static/src/js/chrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2020 Almas Giniatullin <https://it-projects.info/team/almas50>
License MIT (https://opensource.org/licenses/MIT). */
odoo.define("pos_logout.chrome", function (require) {
"use strict";
var chrome = require("point_of_sale.chrome");

chrome.Chrome.include({
loading_hide: function () {
this._super();
var self = this;
var set_logout_interval = function (time) {
time = time || self.pos.config.logout_interval * 1000;
if (time) {
self.pos.logout_timer = setTimeout(function () {
self.pos.gui.show_screen("login");
}, time);
}
};
if (this.pos.config.logout_interval) {
$(document).on("click", function (event) {
clearTimeout(self.pos.logout_timer);
set_logout_interval();
});
set_logout_interval();
}
},
});

return chrome;
});
73 changes: 73 additions & 0 deletions pos_logout/static/src/js/tour.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
* Copyright 2019 Kildebekov Anvar <https://it-projects.info/team/kildebekov>
* License MIT (https://opensource.org/licenses/MIT). */

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

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

function pos_opening() {
return [
tour.stepUtils.showAppsMenuItem(),
{
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>.",
position: "right",
edition: "community",
},
{
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]',
content:
"Ready to launch your <b>point of sale</b>? <i>Click here</i>.",
position: "bottom",
edition: "enterprise",
},
{
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>",
},
{
trigger: ".pos: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 pos_closing() {
return [
{
trigger: ".header-button",
content: "close the Point of Sale frontend",
},
{
trigger: ".header-button, .close_button, .confirm",
content: "close the Point of Sale",
},
{
content: "wait until backend is opened",
trigger: ".o_pos_kanban button.oe_kanban_action_button",
run: function () {
// No need to click on trigger
},
},
];
}

var steps = [];
steps = steps.concat(pos_opening(), pos_closing());

tour.register("pos_logout_tour", {test: true, url: "/web"}, steps);
});
1 change: 1 addition & 0 deletions pos_logout/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_default
Loading