diff --git a/pos_empty_home/README.rst b/pos_empty_home/README.rst new file mode 100644 index 00000000..adfd8384 --- /dev/null +++ b/pos_empty_home/README.rst @@ -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 +`_. 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 + + +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. diff --git a/pos_empty_home/__init__.py b/pos_empty_home/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/pos_empty_home/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/pos_empty_home/__openerp__.py b/pos_empty_home/__openerp__.py new file mode 100644 index 00000000..d9188764 --- /dev/null +++ b/pos_empty_home/__openerp__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2017-Today: La Louve () +# @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, +} diff --git a/pos_empty_home/i18n/fr.po b/pos_empty_home/i18n/fr.po new file mode 100644 index 00000000..562a67c6 --- /dev/null +++ b/pos_empty_home/i18n/fr.po @@ -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" diff --git a/pos_empty_home/static/description/icon.png b/pos_empty_home/static/description/icon.png new file mode 100644 index 00000000..94455447 Binary files /dev/null and b/pos_empty_home/static/description/icon.png differ diff --git a/pos_empty_home/static/description/pos_empty_home.png b/pos_empty_home/static/description/pos_empty_home.png new file mode 100644 index 00000000..66f08811 Binary files /dev/null and b/pos_empty_home/static/description/pos_empty_home.png differ diff --git a/pos_empty_home/static/src/css/pos_empty_home.css b/pos_empty_home/static/src/css/pos_empty_home.css new file mode 100644 index 00000000..967e7065 --- /dev/null +++ b/pos_empty_home/static/src/css/pos_empty_home.css @@ -0,0 +1,12 @@ +/* + Copyright (C) 2017-Today: La Louve () + @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; +} diff --git a/pos_empty_home/static/src/js/db.js b/pos_empty_home/static/src/js/db.js new file mode 100644 index 00000000..e7366ce2 --- /dev/null +++ b/pos_empty_home/static/src/js/db.js @@ -0,0 +1,24 @@ +/* + Copyright (C) 2017-Today: La Louve () + @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 []; + } + }, + }); +}); diff --git a/pos_empty_home/static/src/js/screens.js b/pos_empty_home/static/src/js/screens.js new file mode 100644 index 00000000..d2c6c781 --- /dev/null +++ b/pos_empty_home/static/src/js/screens.js @@ -0,0 +1,24 @@ +/* + Copyright (C) 2017-Today: La Louve () + @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'; + } + }, + }); +}); diff --git a/pos_empty_home/static/src/xml/pos_empty_home.xml b/pos_empty_home/static/src/xml/pos_empty_home.xml new file mode 100644 index 00000000..0c87636c --- /dev/null +++ b/pos_empty_home/static/src/xml/pos_empty_home.xml @@ -0,0 +1,18 @@ + + + + + + + +
+ To select a product, please scan a barcode or search products by category or by name +
+
+
+ +
diff --git a/pos_empty_home/static/src/xml/templates.xml b/pos_empty_home/static/src/xml/templates.xml new file mode 100644 index 00000000..4d3e9ebd --- /dev/null +++ b/pos_empty_home/static/src/xml/templates.xml @@ -0,0 +1,21 @@ + + + + +