Skip to content

Commit

Permalink
Merge pull request #170 from legalsylvain/9.0_ADD_pos_empty_home
Browse files Browse the repository at this point in the history
[ADD] module pos_empty_home
  • Loading branch information
rafaelbn committed Jun 8, 2017
2 parents 08bbed7 + da45fb5 commit 0412ae8
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 0 deletions.
60 changes: 60 additions & 0 deletions pos_empty_home/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. 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

==========================
Point of Sale - Empty Home
==========================

This module extends Odoo Point Of Sale features, displaying an empty home page
at the start of the Point of Sale, or when no search is done and no category
is selected. (when root category is selected)

This module is interesting to avoid to display useless products, when user did
not yet realized a search. (Default displayed products are just the first
eighty products)

It can limits errors to avoid users to select undesired product.


.. image:: /pos_empty_home/static/description/pos_empty_home.png
:width: 800 px

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 smash it by providing 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 change: 1 addition & 0 deletions pos_empty_home/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
24 changes: 24 additions & 0 deletions pos_empty_home/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-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 - Empty Home',
'version': '9.0.1.0.0',
'category': 'Point Of Sale',
'summary': 'Hide products at the start of the Point of Sale',
'author': 'La Louve, GRAP, Odoo Community Association (OCA)',
'website': 'http://www.lalouve.net/',
'license': 'AGPL-3',
'depends': [
'point_of_sale',
],
'data': [
'static/src/xml/templates.xml',
],
'qweb': [
'static/src/xml/pos_empty_home.xml',
],
'installable': True,
}
23 changes: 23 additions & 0 deletions pos_empty_home/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_empty_home
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-05 09:32+0000\n"
"PO-Revision-Date: 2017-05-05 09:32+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"

#. module: pos_empty_home
#. openerp-web
#: code:addons/pos_empty_home/static/src/xml/pos_empty_home.xml:12
#, python-format
msgid "To select a product, please scan a barcode or search products by category or by name"
msgstr "Pour sélectionner un produit, veuillez scanner un code barre, ou bien réaliser une recherche de produits par catégorie ou par nom"
Binary file added pos_empty_home/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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions pos_empty_home/static/src/css/pos_empty_home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Copyright (C) 2017-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).
*/

.product-list-empty-home {
height: 80%;
text-align: center;
padding: 15%;
font-size: x-large;
}
24 changes: 24 additions & 0 deletions pos_empty_home/static/src/js/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (C) 2017-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_empty_home.db', function (require) {
"use strict";

var PosDB = require('point_of_sale.DB');

PosDB.include({
get_product_by_category: function(category_id){
console.log(this.config);
if (category_id != 0){
return this._super(category_id);
}
else{
return [];
}
},
});
});
24 changes: 24 additions & 0 deletions pos_empty_home/static/src/js/screens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (C) 2017-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_empty_home.screens', function (require) {
"use strict";

var screens = require('point_of_sale.screens');

screens.ProductListWidget.include({
renderElement: function() {
this._super();
if (this.product_list.length == 0){
this.el.querySelector('.product-list-empty-home').style['display'] = 'block';
}
else{
this.el.querySelector('.product-list-empty-home').style['display'] = 'none';
}
},
});
});
18 changes: 18 additions & 0 deletions pos_empty_home/static/src/xml/pos_empty_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017-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="ProductListWidget">
<t t-jquery=".product-list" t-operation="before">
<div class="product-list-empty-home">
To select a product, please scan a barcode or search products by category or by name
</div>
</t>
</t>

</templates>
21 changes: 21 additions & 0 deletions pos_empty_home/static/src/xml/templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017-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_empty_home/static/src/js/db.js"/>
<script type="text/javascript" src="/pos_empty_home/static/src/js/screens.js"/>
<xpath expr="//link[@id='pos-stylesheet']" position="after">
<link rel="stylesheet" href="/pos_empty_home/static/src/css/pos_empty_home.css" />
</xpath>
</xpath>

</template>
</odoo>


0 comments on commit 0412ae8

Please sign in to comment.