Browse Source

[ADD] new module pos_quick_logout (#116)

pull/239/head
Sylvain LE GAL 8 years ago
parent
commit
ede165c476
  1. 68
      pos_quick_logout/README.rst
  2. 1
      pos_quick_logout/__init__.py
  3. 24
      pos_quick_logout/__openerp__.py
  4. 15
      pos_quick_logout/i18n/fr.po
  5. BIN
      pos_quick_logout/static/description/cashier_user_different.png
  6. BIN
      pos_quick_logout/static/description/cashier_user_identical.png
  7. BIN
      pos_quick_logout/static/description/icon.png
  8. 15
      pos_quick_logout/static/src/css/pos_quick_logout.css
  9. 40
      pos_quick_logout/static/src/js/pos_quick_logout.js
  10. 18
      pos_quick_logout/static/src/xml/pos_quick_logout.xml
  11. 17
      pos_quick_logout/static/src/xml/templates.xml

68
pos_quick_logout/README.rst

@ -0,0 +1,68 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==================
PoS - Quick Logout
==================
This module was written to extend the functionality of Odoo Point Of Sale about
changing of cashier.
This module add a simple button 'Log Out' available in Point Of Sale Front End
UI. This button is available when the cashier is not the initial user logged in
Odoo. It allows to log out quickly, wihout selecting again the user in the
list. This module is useful for users that use regularly the change of cashier,
especialy with 'pos_access_right', when users doesn't have the right to do some
actions like set discount, change unit price, ...
Implemented Features
--------------------
* By default, the header is unchanged
.. image:: /pos_quick_logout/static/description/cashier_user_identical.png
* If the cashier changed, and is not the user logged in Odoo, the extra button
appears
.. image:: /pos_quick_logout/static/description/cashier_user_different.png
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/pos/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Sylvain LE GAL <https://twitter.com/legalsylvain>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

1
pos_quick_logout/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

24
pos_quick_logout/__openerp__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Point of Sale - Quick Logout',
'version': '9.0.1.0.0',
'category': 'Point Of Sale',
'summary': 'Allow PoS user to logout quickly after user changed',
'author': 'La Louve, Odoo Community Association (OCA)',
'website': 'http://www.lalouve.net',
'depends': [
'point_of_sale',
],
'data': [
'static/src/xml/templates.xml',
],
'qweb': [
'static/src/xml/pos_quick_logout.xml',
],
'installable': True,
}

15
pos_quick_logout/i18n/fr.po

@ -0,0 +1,15 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-03 23:52+0000\n"
"PO-Revision-Date: 2016-04-03 23:52+0000\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"

BIN
pos_quick_logout/static/description/cashier_user_different.png

After

Width: 390  |  Height: 39  |  Size: 6.1 KiB

BIN
pos_quick_logout/static/description/cashier_user_identical.png

After

Width: 392  |  Height: 39  |  Size: 5.6 KiB

BIN
pos_quick_logout/static/description/icon.png

After

Width: 64  |  Height: 64  |  Size: 4.0 KiB

15
pos_quick_logout/static/src/css/pos_quick_logout.css

@ -0,0 +1,15 @@
/*
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
.pos .pos-branding .pos-logout{
float:right;
color:#DDD;
font-size:16px;
margin-right:32px;
line-height: 48px;
font-style:italic;
cursor: pointer;
}

40
pos_quick_logout/static/src/js/pos_quick_logout.js

@ -0,0 +1,40 @@
/*
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define('pos_quick_logout.pos_quick_logout', function (require) {
"use strict";
var chrome = require('point_of_sale.chrome');
/* ********************************************************
chrome.Chrome
******************************************************** */
chrome.Chrome.include({
renderElement: function(){
this._super();
var self = this;
this.$('#pos-quick-logout').click(function(){
self.pos.set_cashier(self.pos.user);
self.widget.username.renderElement();
});
},
});
/* ********************************************************
chrome.Chrome
******************************************************** */
chrome.UsernameWidget.include({
renderElement: function(){
this._super();
if (this.pos.user.id != this.pos.get_cashier().id){
$('#pos-quick-logout').show();
}else{
$('#pos-quick-logout').hide();
}
},
});
});

18
pos_quick_logout/static/src/xml/pos_quick_logout.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<templates id="template" xml:space="preserve">
<t t-extend="Chrome">
<t t-jquery=".placeholder-UsernameWidget" t-operation="after">
<span class="username" id="pos-quick-logout">
Log Out
</span>
</t>
</t>
</templates>

17
pos_quick_logout/static/src/xml/templates.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<template id="assets_frontend" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_quick_logout/static/src/js/pos_quick_logout.js"/>
</xpath>
<xpath expr="//link[@id='pos-stylesheet']" position="after">
<link rel="stylesheet" href="/pos_quick_logout/static/src/css/pos_quick_logout.css" />
</xpath>
</template>
</odoo>
Loading…
Cancel
Save