Skip to content

Commit

Permalink
Merge PR #1 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Oct 15, 2024
2 parents 65ab4d6 + 2e7c72c commit 1a4aced
Show file tree
Hide file tree
Showing 22 changed files with 747 additions and 0 deletions.
Empty file.
1 change: 1 addition & 0 deletions pos_odoo_driver_display/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions pos_odoo_driver_display/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @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 - LED Customer Display (odoo-pos-driver)",
"version": "16.0.1.0.0",
"category": "Point Of Sale",
"summary": "Communicate with LEC Customer Display via odoo-pos-driver library",
"author": "GRAP",
"website": "https://github.com/grap/odoo-addons-pos",
"license": "AGPL-3",
"depends": ["point_of_sale"],
"assets": {
"point_of_sale.assets": [
"pos_odoo_driver_display/static/src/js/devices.esm.js",
"pos_odoo_driver_display/static/src/js/ProxyStatus.esm.js",
"pos_odoo_driver_display/static/src/js/models.esm.js",
"pos_odoo_driver_display/static/src/js/Chrome.esm.js",
"pos_odoo_driver_display/static/src/js/PaymentScreen.esm.js",
],
},
"data": ["views/view_pos_config.xml"],
"installable": True,
}
182 changes: 182 additions & 0 deletions pos_odoo_driver_display/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_odoo_driver_display
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-10 11:21+0000\n"
"PO-Revision-Date: 2024-09-10 11:21+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_odoo_driver_display
#: model:ir.model.fields.selection,name:pos_odoo_driver_display.selection__pos_config__customer_display_format__2_20
msgid "2 Lines of 20 Characters"
msgstr "2 lignes de 20 caractères"

#. module: pos_odoo_driver_display
#: model:ir.model,name:pos_odoo_driver_display.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de configuration"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_format
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_format
msgid "Customer Display Format"
msgstr "Format de l'afficheur client"

#. module: pos_odoo_driver_display
#. odoo-javascript
#: code:addons/pos_odoo_driver_display/static/src/js/ProxyStatus.esm.js:0
#, python-format
msgid "Display"
msgstr "Afficheur"

#. module: pos_odoo_driver_display
#. odoo-javascript
#: code:addons/pos_odoo_driver_display/static/src/js/ProxyStatus.esm.js:0
#, python-format
msgid "Display Offline"
msgstr "Afficheur Hors ligne"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__iface_customer_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_res_config_settings__pos_iface_customer_display
msgid "Display data on the customer display"
msgstr "Afficher les données sur l'afficheur client"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__customer_display_msg_next_l1
#: model:ir.model.fields,help:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_next_l1
msgid ""
"First line of the message on the customer display which is displayed after "
"starting POS and also after validation of an order"
msgstr ""
"Première ligne du message de l'afficheur client qui est affiché après le "
"démarrage de la caisse et également après validation d'une commande client"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__customer_display_msg_closed_l1
#: model:ir.model.fields,help:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_closed_l1
msgid ""
"First line of the message on the customer display which is displayed when "
"POS is closed"
msgstr ""
"Première ligne du message de l'afficheur client qui est affiché quand la "
"caisse est fermée"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__iface_customer_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_iface_customer_display
#: model_terms:ir.ui.view,arch_db:pos_odoo_driver_display.view_res_config_settings_form
msgid "LED Customer Display"
msgstr "Afficheur client LED"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__customer_display_line_length
msgid "Length of the LEDs lines of the customer display"
msgstr "Longueur des lignes de l'afficheur client (nombre de caractères)"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_line_length
msgid "Line Length"
msgstr "Longueur des lignes"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_msg_next_l1
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_next_l1
msgid "Next Customer (Line 1)"
msgstr "Client suivant (ligne 1)"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_msg_next_l2
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_next_l2
msgid "Next Customer (Line 2)"
msgstr "Client suivant (ligne 2)"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_msg_closed_l1
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_closed_l1
msgid "PoS Closed (Line 1)"
msgstr "Caisse fermée (Ligne 1)"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_pos_config__customer_display_msg_closed_l2
#: model:ir.model.fields,field_description:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_closed_l2
msgid "PoS Closed (Line 2)"
msgstr "Caisse fermée (Ligne 2)"

#. module: pos_odoo_driver_display
#. odoo-python
#: code:addons/pos_odoo_driver_display/models/pos_config.py:0
#, python-format
msgid "Point of Sale Closed"
msgstr "Caisse fermée"

#. module: pos_odoo_driver_display
#: model:ir.model,name:pos_odoo_driver_display.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Configuration du point de vente"

#. module: pos_odoo_driver_display
#. odoo-python
#: code:addons/pos_odoo_driver_display/models/pos_config.py:0
#, python-format
msgid "Point of Sale Open"
msgstr "Caisse ouverte"

#. module: pos_odoo_driver_display
#: model:ir.model,name:pos_odoo_driver_display.model_pos_session
msgid "Point of Sale Session"
msgstr "Session du point de vente"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__customer_display_msg_next_l2
#: model:ir.model.fields,help:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_next_l2
msgid ""
"Second line of the message on the customer display which is displayed after "
"starting POS and also after validation of an order"
msgstr ""
"Deuxième ligne du message de l'afficheur client qui est affiché après le "
"démarrage de la caisse et également après validation d'une commande client"

#. module: pos_odoo_driver_display
#: model:ir.model.fields,help:pos_odoo_driver_display.field_pos_config__customer_display_msg_closed_l2
#: model:ir.model.fields,help:pos_odoo_driver_display.field_res_config_settings__pos_customer_display_msg_closed_l2
msgid ""
"Second line of the message on the customer display which is displayed when "
"POS is closed"
msgstr ""
"Deuxième ligne du message de l'afficheur client qui est affiché quand la "
"caisse est fermée"

#. module: pos_odoo_driver_display
#. odoo-python
#: code:addons/pos_odoo_driver_display/models/pos_config.py:0
#, python-format
msgid "See you soon!"
msgstr "Au revoir !"

#. module: pos_odoo_driver_display
#. odoo-python
#: code:addons/pos_odoo_driver_display/models/pos_config.py:0
#, python-format
msgid ""
"The message for customer display '%(field_name)s' is too long: it has "
"%(current_size)d chars whereas the maximum is %(maxsize)d chars."
msgstr ""
"Le message de l'afficheur client '%(field_name)s' est trop long : il contient %(current_size)d "
"caractères alors que le maximum est de %(maxsize)d caractères."

#. module: pos_odoo_driver_display
#. odoo-python
#: code:addons/pos_odoo_driver_display/models/pos_config.py:0
#, python-format
msgid "Welcome!"
msgstr "Bienvenue !"
3 changes: 3 additions & 0 deletions pos_odoo_driver_display/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import pos_config
from . import res_config_settings
from . import pos_session
101 changes: 101 additions & 0 deletions pos_odoo_driver_display/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# © 2014-2016 Aurélien DUMAINE
# © 2015-2016 Akretion (Alexis de Lattre <[email protected]>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class PosConfig(models.Model):
_inherit = "pos.config"

_CUSTOMER_DISPLAY_FORMAT_SELECTION = [
("2_20", "2 Lines of 20 Characters"),
]

iface_customer_display = fields.Boolean(
string="LED Customer Display", help="Display data on the customer display"
)

customer_display_format = fields.Selection(
selection=_CUSTOMER_DISPLAY_FORMAT_SELECTION,
default="2_20",
required=True,
)

customer_display_line_length = fields.Integer(
string="Line Length",
compute="_compute_customer_display_line_length",
store=True,
help="Length of the LEDs lines of the customer display",
)
customer_display_msg_next_l1 = fields.Char(
string="Next Customer (Line 1)",
default=lambda x: x._default_customer_display_msg("next_l1"),
help="First line of the message on the customer display which is "
"displayed after starting POS and also after validation of an order",
)
customer_display_msg_next_l2 = fields.Char(
string="Next Customer (Line 2)",
default=lambda x: x._default_customer_display_msg("next_l2"),
help="Second line of the message on the customer display which is "
"displayed after starting POS and also after validation of an order",
)
customer_display_msg_closed_l1 = fields.Char(
string="PoS Closed (Line 1)",
default=lambda x: x._default_customer_display_msg("closed_l1"),
help="First line of the message on the customer display which "
"is displayed when POS is closed",
)
customer_display_msg_closed_l2 = fields.Char(
string="PoS Closed (Line 2)",
default=lambda x: x._default_customer_display_msg("closed_l2"),
help="Second line of the message on the customer display which "
"is displayed when POS is closed",
)

@api.model
def _default_customer_display_msg(self, line):
if line == "next_l1":
return _("Point of Sale Open")
elif line == "next_l2":
return _("Welcome!")
elif line == "closed_l1":
return _("Point of Sale Closed")
elif line == "closed_l2":
return _("See you soon!")

@api.depends("customer_display_format")
def _compute_customer_display_line_length(self):
for config in self:
config.customer_display_line_length = int(
config.customer_display_format.split("_")[1]
)

@api.constrains(
"iface_customer_display",
"customer_display_format",
"customer_display_msg_next_l1",
"customer_display_msg_next_l2",
"customer_display_msg_closed_l1",
"customer_display_msg_closed_l2",
)
def _check_customer_display_length(self):
for config in self.filtered(lambda x: x.customer_display_line_length):
maxsize = config.customer_display_line_length
fields_to_check = [
x for x in self._fields.keys() if "customer_display_msg_" in x
]
for field_name in fields_to_check:
value = getattr(config, field_name)
if value and len(value) > maxsize:
raise ValidationError(
_(
"The message for customer display '%(field_name)s' is too "
"long: it has %(current_size)d chars whereas the maximum "
"is %(maxsize)d chars.",
field_name=self._fields[field_name].string,
current_size=len(value),
maxsize=maxsize,
)
)
16 changes: 16 additions & 0 deletions pos_odoo_driver_display/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _get_pos_ui_pos_config(self, params):
config = super()._get_pos_ui_pos_config(params)
config["use_proxy"] = config["use_proxy"] or (
config["is_posbox"] and config["iface_customer_display"]
)
return config
30 changes: 30 additions & 0 deletions pos_odoo_driver_display/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_iface_customer_display = fields.Boolean(
related="pos_config_id.iface_customer_display", readonly=False
)
pos_customer_display_format = fields.Selection(
related="pos_config_id.customer_display_format",
readonly=False,
required=True,
)
pos_customer_display_msg_next_l1 = fields.Char(
related="pos_config_id.customer_display_msg_next_l1", readonly=False
)
pos_customer_display_msg_next_l2 = fields.Char(
related="pos_config_id.customer_display_msg_next_l2", readonly=False
)
pos_customer_display_msg_closed_l1 = fields.Char(
related="pos_config_id.customer_display_msg_closed_l1", readonly=False
)
pos_customer_display_msg_closed_l2 = fields.Char(
related="pos_config_id.customer_display_msg_closed_l2", readonly=False
)
10 changes: 10 additions & 0 deletions pos_odoo_driver_display/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
To configure this module,
* go to the menu Point of Sale > Configuration > Point of Sale
* edit the point of sale for which you want to enable the LED:

* In the IotBox section, activate the option *LED Customer Display*,
* configure the format of your LED screen. (2 lines of 20 characters, by default)

* optionaly, you can customize the *Next customer* message and the *POS closed* message

.. figure:: ../static/img/pos_config_form.png
7 changes: 7 additions & 0 deletions pos_odoo_driver_display/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module is a full refactor of the OCA V12 module ``pos_customer_display``.
Original authors and ideas are:

* Aurélien Dumaine
* Alexis de Lattre <[email protected]>
* Father Odilon (`Barroux Abbey <http://www.barroux.org/>`_)
* Daniel Kraft
4 changes: 4 additions & 0 deletions pos_odoo_driver_display/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module extends the Point of Sale odoo module, to add compatibility with the ``odoo-pos-driver``
python library, when using LED Customer display.

More information: https://pypi.org/project/odoo-pos-driver/
Loading

0 comments on commit 1a4aced

Please sign in to comment.