Browse Source

Port pos_customer_display to v10

Remove the "Show total to customer" button, which is not need given the new user interface of the POS: the big "Payment" button has this role now.
Add README.rst
pull/174/head
Alexis de Lattre 8 years ago
committed by Sylvain LE GAL
parent
commit
b2e23d5496
  1. 90
      pos_customer_display/README.rst
  2. 4
      pos_customer_display/__init__.py
  3. 51
      pos_customer_display/__manifest__.py
  4. 6
      pos_customer_display/demo/pos_customer_display_demo.xml
  5. 3
      pos_customer_display/models/__init__.py
  6. 32
      pos_customer_display/models/pos_customer_display.py
  7. 15
      pos_customer_display/static/src/css/pos_customer_display.css
  8. 27
      pos_customer_display/static/src/js/customer_display.js
  9. 14
      pos_customer_display/static/src/xml/pos.xml
  10. 22
      pos_customer_display/views/customer_display_view.xml
  11. 9
      pos_customer_display/views/pos_customer_display.xml

90
pos_customer_display/README.rst

@ -0,0 +1,90 @@
.. 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 Customer Display
====================
This module adds support for Customer Display in the Point of Sale. As incredible as it may seem, the Odoo POS doesn't have native support for a customer display, even on Odoo 10. So, if the customer cannot see the screen of the cashier, he will not be able to check the price of each product scanned by the cashier, he won't be able to see the total amount, etc. This module provides a solution to this problem by adding support for good old POS LCDs, which are often made of 2 lines of 20 caracters.
This module is designed to be installed on the *main Odoo server*. On the
*POSbox*, you should install the module *hw_customer_display*. But you will certainly prefer to use `pywebdriver <https://github.com/akretion/pywebdriver>`_ instead of the POSbox. Compared to the POSbox, Pywebdriver has several advantages:
* smaller footprint: no need to have a full-blown Odoo with PostgreSQL on the computer of the cashier (or his small Linux-based PC connected to the hardware, like the RaspberryPi for the POSbox),
* availability of an Ubuntu package, for easier deployment,
* native support for the customer display, payment terminal, etc.
* nice test/diagnosis Web interface.
It has been tested with a Bixolon BCD-1100
(http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61),
but should support most serial and USB-serial LCD displays
out-of-the-box or with minor adaptations in the source code:
* of the module *hw_customer_display* if you use the POSbox,
* or of the Python lib `pyposdisplay <https://github.com/akretion/pyposdisplay>`_ if you use `pywebdriver <https://github.com/akretion/pywebdriver>`_.
This module has been developped during a POS code sprint at
`Akretion France <http://www.akretion.com/>`_ from July 7th to July 10th 2014.
Configuration
=============
To configure this module, go to the menu *Point of Sale > Configuration > Point
of Sale* and edit the point of sale for which you want to enable the LCD:
* make sure you have configured the *IP address* and port of the POSbox or pywebdriver in the section *Hardware Proxy / PosBox*,
* activate the option *Customer Display*,
* configure the number of caracters on each line of your LCD (20 by default).
At the end of the page, in the *Customer Display* section, you can customize the *Next customer* message and the *POS closed* message.
Usage
=====
Once everything is configured, just start the POS as usual. You will see messages on the LCD when:
* you start the POS,
* you add or remove a product,
* you press the Payment button: the LCD will display the total amount,
* you enter the amount of cash you receive: the LCD will display the amount of the change to give back,
* you validate an order and go to the next customer,
* you close the POS.
.. 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/10.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
------------
* Aurélien Dumaine
* Alexis de Lattre <alexis.delattre@akretion.com>
* Father Odilon (`Barroux Abbey <http://www.barroux.org/>`_)
* Daniel Kraft
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.

4
pos_customer_display/__init__.py

@ -1 +1,3 @@
from . import pos_customer_display
# -*- coding: utf-8 -*-
from . import models

51
pos_customer_display/__manifest__.py

@ -1,53 +1,13 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# POS Customer Display module for Odoo
# Copyright (C) 2014 Aurélien DUMAINE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2014-2016 Aurélien DUMAINE
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'POS Customer Display',
'version': '9.0.0.1.0',
'version': '10.0.1.0.0',
'category': 'Point Of Sale',
'summary': 'Manage Customer Display device from POS front end',
'description': """
POS Customer Display
====================
This module adds support for Customer Display in the Point of Sale. This
module is designed to be installed on the *main Odoo server*. On the
*POSbox*, you should install the module *hw_customer_display*.
The number of rows and cols of the Customer Display (usually 2 x 20)
should be configured on the main Odoo server, in the menu Point of Sale
> Configuration > Point of Sales.
It has been tested with a Bixolon BCD-1100
(http://www.bixolon.com/html/en/product/product_detail.xhtml?prod_id=61),
but should support most serial and USB-serial LCD displays
out-of-the-box, cf the module *hw_customer_display* for more info.
This module has been developped during a POS code sprint at Akretion
France from July 7th to July 10th 2014. This module is part of the POS
project of the Odoo Community Association http://odoo-community.org/.
You are invited to become a member and/or get involved in the
Association !
""",
'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)",
'license': 'AGPL-3',
'depends': ['point_of_sale'],
@ -55,7 +15,6 @@ Association !
'views/pos_customer_display.xml',
'views/customer_display_view.xml',
],
'qweb': ['static/src/xml/pos.xml'],
'demo': ['pos_customer_display_demo.xml'],
'demo': ['demo/pos_customer_display_demo.xml'],
'installable': True,
}

6
pos_customer_display/pos_customer_display_demo.xml → pos_customer_display/demo/pos_customer_display_demo.xml

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<odoo noupdate="1">
<record id="point_of_sale.pos_config_main" model="pos.config">
@ -9,5 +8,4 @@
</record>
</data>
</openerp>
</odoo>

3
pos_customer_display/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import pos_customer_display

32
pos_customer_display/pos_customer_display.py → pos_customer_display/models/pos_customer_display.py

@ -1,28 +1,10 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# POS Customer Display module for Odoo
# Copyright (C) 2014 Aurélien DUMAINE
# Copyright (C) 2015 Akretion (www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2014-2016 Aurélien DUMAINE
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class PosConfig(models.Model):
@ -70,8 +52,8 @@ class PosConfig(models.Model):
}
for field, msg in to_check.iteritems():
if msg and len(msg) > maxsize:
raise ValidationError(
_("The message for customer display '%s' is too "
raise ValidationError(_(
"The message for customer display '%s' is too "
"long: it has %d chars whereas the maximum "
"is %d chars.")
% (field, len(msg), maxsize))

15
pos_customer_display/static/src/css/pos_customer_display.css

@ -1,15 +0,0 @@
.pos .show-total-to-customer {
width: 220px;
height: 40px;
font-size: 16px;
cursor: pointer;
text-align: center;
box-sizing: border-box;
}
.pos .show-total-to-customer-div {
float: left;
margin-right: 15px;
margin-left: 15px;
margin-top: 20px;
}

27
pos_customer_display/static/src/js/customer_display.js

@ -1,11 +1,11 @@
/*
POS Customer display module for Odoo
Copyright (C) 2014 Aurélien DUMAINE
Copyright (C) 2014 Barroux Abbey (www.barroux.org)
© 2014-2016 Aurélien DUMAINE
© 2014-2016 Barroux Abbey (www.barroux.org)
© 2014-2016 Akretion (www.akretion.com)
@author: Aurélien DUMAINE
@author: Alexis de Lattre <alexis.delattre@akretion.com>
@author: Father Odilon (Barroux Abbey)
The licence is in the file __openerp__.py
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
*/
odoo.define('pos_customer_display', function(require) {
@ -244,18 +244,11 @@ odoo.define('pos_customer_display', function(require) {
},
});
/* Handle Button "Display Total to Customer" */
var _saved_renderElement = screens.OrderWidget.prototype.renderElement;
screens.OrderWidget.prototype.renderElement = function() {
_saved_renderElement.apply(this, arguments);
var self = this;
if (self.pos.config.iface_customer_display && self.el.querySelector('.show-total-to-customer')) {
// .show-total-to-customer is empty when we show the bon during payment
self.el.querySelector('.show-total-to-customer')
.addEventListener('click', function(){
self.pos.prepare_text_customer_display('add_paymentline', {})
screens.PaymentScreenWidget.include({
show: function(){
this._super();
this.pos.prepare_text_customer_display('add_paymentline', {});
},
});
}
};
});
});

14
pos_customer_display/static/src/xml/pos.xml

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="OrderWidget" >
<t t-jquery=".summary" t-operation="append">
<t t-if="widget.pos.config.iface_customer_display">
<div class="show-total-to-customer-div">
<button class="show-total-to-customer">
Display Total to Customer
</button>
</div>
</t>
</t>
</t>
</templates>

22
pos_customer_display/views/customer_display_view.xml

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_pos_config_form2" model="ir.ui.view">
<field name="name">pos.config.form.view.inherit</field>
<odoo>
<record id="view_pos_config_form" model="ir.ui.view">
<field name="name">pos_customer_display.pos.config.form</field>
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
<field name="arch" type="xml">
@ -12,13 +12,15 @@
</field>
<group name="receipt" position="after">
<group name="customer_display" string="Customer Display">
<field name="customer_display_msg_next_l1"/>
<field name="customer_display_msg_next_l2"/>
<field name="customer_display_msg_closed_l1"/>
<field name="customer_display_msg_closed_l2"/>
<label string="Next Customer Message" name="next_customer" colspan="2"/>
<field name="customer_display_msg_next_l1" string="Top Line"/>
<field name="customer_display_msg_next_l2" string="Bottom Line"/>
<label string="POS Closed Message" name="pos_closed" colspan="2"/>
<field name="customer_display_msg_closed_l1" string="Top Line"/>
<field name="customer_display_msg_closed_l2" string="Bottom Line"/>
</group>
</group>
</field>
</record>
</data>
</openerp>
</odoo>

9
pos_customer_display/views/pos_customer_display.xml

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<template id="assets" name="pos_customer_display assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_customer_display/static/src/js/customer_display.js"></script>
<link rel="stylesheet" href="/pos_customer_display/static/src/css/pos_customer_display.css" id="pos_customer_display-stylesheet"/>
</xpath>
</template>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save