Browse Source

[ADD] module pos_empty_home

pull/453/head
Sylvain LE GAL 8 years ago
committed by Iván Todorovich
parent
commit
3ef423c8b8
  1. 60
      pos_empty_home/README.rst
  2. 1
      pos_empty_home/__init__.py
  3. 24
      pos_empty_home/__openerp__.py
  4. 23
      pos_empty_home/i18n/fr.po
  5. BIN
      pos_empty_home/static/description/icon.png
  6. BIN
      pos_empty_home/static/description/pos_empty_home.png
  7. 12
      pos_empty_home/static/src/css/pos_empty_home.css
  8. 24
      pos_empty_home/static/src/js/db.js
  9. 24
      pos_empty_home/static/src/js/screens.js
  10. 18
      pos_empty_home/static/src/xml/pos_empty_home.xml
  11. 21
      pos_empty_home/static/src/xml/templates.xml

60
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
<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
pos_empty_home/__init__.py

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

24
pos_empty_home/__openerp__.py

@ -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
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"

BIN
pos_empty_home/static/description/icon.png

After

Width: 64  |  Height: 64  |  Size: 3.9 KiB

BIN
pos_empty_home/static/description/pos_empty_home.png

After

Width: 1220  |  Height: 590  |  Size: 48 KiB

12
pos_empty_home/static/src/css/pos_empty_home.css

@ -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
pos_empty_home/static/src/js/db.js

@ -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
pos_empty_home/static/src/js/screens.js

@ -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
pos_empty_home/static/src/xml/pos_empty_home.xml

@ -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
pos_empty_home/static/src/xml/templates.xml

@ -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>
Loading…
Cancel
Save