From cfe96ea1f12b05b6733c7ffa5aa283eda7c05894 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 10 Sep 2024 19:30:05 +0200 Subject: [PATCH 1/2] [ADD] pos_odoo_driver_payment --- pos_odoo_driver_payment/README.rst | 0 pos_odoo_driver_payment/__init__.py | 1 + pos_odoo_driver_payment/__manifest__.py | 35 +++++++ pos_odoo_driver_payment/i18n/fr.po | 96 ++++++++++++++++++ pos_odoo_driver_payment/models/__init__.py | 4 + pos_odoo_driver_payment/models/pos_config.py | 23 +++++ .../models/pos_payment_method.py | 11 ++ pos_odoo_driver_payment/models/pos_session.py | 16 +++ .../models/res_config_settings.py | 13 +++ pos_odoo_driver_payment/readme/CONFIGURE.rst | 5 + .../readme/CONTRIBUTORS.rst | 6 ++ .../readme/DESCRIPTION.rst | 4 + pos_odoo_driver_payment/readme/USAGE.rst | 7 ++ .../static/description/pos_front_end.png | Bin 0 -> 4922 bytes .../description/pos_payment_method_form.png | Bin 0 -> 10157 bytes .../static/src/css/pos.css | 7 ++ .../static/src/js/PaymentScreen.esm.js | 39 +++++++ .../static/src/js/ProxyStatus.esm.js | 37 +++++++ .../static/src/js/devices.esm.js | 23 +++++ .../src/xml/PaymentScreenPaymentLines.xml | 21 ++++ .../views/view_pos_payment_method.xml | 19 ++++ .../views/view_res_config_settings.xml | 29 ++++++ .../odoo/addons/pos_odoo_driver_payment | 1 + setup/pos_odoo_driver_payment/setup.py | 6 ++ 24 files changed, 403 insertions(+) create mode 100644 pos_odoo_driver_payment/README.rst create mode 100644 pos_odoo_driver_payment/__init__.py create mode 100644 pos_odoo_driver_payment/__manifest__.py create mode 100644 pos_odoo_driver_payment/i18n/fr.po create mode 100644 pos_odoo_driver_payment/models/__init__.py create mode 100644 pos_odoo_driver_payment/models/pos_config.py create mode 100644 pos_odoo_driver_payment/models/pos_payment_method.py create mode 100644 pos_odoo_driver_payment/models/pos_session.py create mode 100644 pos_odoo_driver_payment/models/res_config_settings.py create mode 100644 pos_odoo_driver_payment/readme/CONFIGURE.rst create mode 100644 pos_odoo_driver_payment/readme/CONTRIBUTORS.rst create mode 100644 pos_odoo_driver_payment/readme/DESCRIPTION.rst create mode 100644 pos_odoo_driver_payment/readme/USAGE.rst create mode 100644 pos_odoo_driver_payment/static/description/pos_front_end.png create mode 100644 pos_odoo_driver_payment/static/description/pos_payment_method_form.png create mode 100644 pos_odoo_driver_payment/static/src/css/pos.css create mode 100644 pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js create mode 100644 pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js create mode 100644 pos_odoo_driver_payment/static/src/js/devices.esm.js create mode 100644 pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml create mode 100644 pos_odoo_driver_payment/views/view_pos_payment_method.xml create mode 100644 pos_odoo_driver_payment/views/view_res_config_settings.xml create mode 120000 setup/pos_odoo_driver_payment/odoo/addons/pos_odoo_driver_payment create mode 100644 setup/pos_odoo_driver_payment/setup.py diff --git a/pos_odoo_driver_payment/README.rst b/pos_odoo_driver_payment/README.rst new file mode 100644 index 0000000..e69de29 diff --git a/pos_odoo_driver_payment/__init__.py b/pos_odoo_driver_payment/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/pos_odoo_driver_payment/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_odoo_driver_payment/__manifest__.py b/pos_odoo_driver_payment/__manifest__.py new file mode 100644 index 0000000..5780ef9 --- /dev/null +++ b/pos_odoo_driver_payment/__manifest__.py @@ -0,0 +1,35 @@ +# 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 - Telium Payment Terminal (odoo-pos-driver)", + "version": "16.0.1.0.0", + "category": "Point Of Sale", + "summary": "Communicate with Telium Payment Terminal" + " via odoo-pos-driver library", + "author": ( + "Aurélien DUMAINE," + "GRAP," + "Akretion," + "ACSONE SA/NV," + "Odoo Community Association (OCA)" + ), + "website": "https://github.com/grap/odoo-addons-pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "assets": { + "point_of_sale.assets": [ + "pos_odoo_driver_payment/static/src/css/pos.css", + "pos_odoo_driver_payment/static/src/js/devices.esm.js", + "pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js", + "pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js", + "pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml", + ], + }, + "data": [ + "views/view_res_config_settings.xml", + "views/view_pos_payment_method.xml", + ], + "installable": True, +} diff --git a/pos_odoo_driver_payment/i18n/fr.po b/pos_odoo_driver_payment/i18n/fr.po new file mode 100644 index 0000000..04668a4 --- /dev/null +++ b/pos_odoo_driver_payment/i18n/fr.po @@ -0,0 +1,96 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_odoo_driver_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-10 22:50+0000\n" +"PO-Revision-Date: 2024-09-10 22:50+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_payment +#: model:ir.model.fields,help:pos_odoo_driver_payment.field_pos_config__iface_payment_terminal +#: model:ir.model.fields,help:pos_odoo_driver_payment.field_res_config_settings__pos_iface_payment_terminal +msgid "A payment terminal is available on the Proxy" +msgstr "Un terminal de paiement est disponible via le proxy" + +#. module: pos_odoo_driver_payment +#. odoo-javascript +#: code:addons/pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js:0 +#, python-format +msgid "Communication failed" +msgstr "Echec de la communication" + +#. module: pos_odoo_driver_payment +#: model:ir.model,name:pos_odoo_driver_payment.model_res_config_settings +msgid "Config Settings" +msgstr "Paramètres de configuration" + +#. module: pos_odoo_driver_payment +#. odoo-javascript +#: code:addons/pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js:0 +#, python-format +msgid "EPT" +msgstr "TPE" + +#. module: pos_odoo_driver_payment +#. odoo-javascript +#: code:addons/pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js:0 +#, python-format +msgid "EPT Offline" +msgstr "TPE hors ligne" + +#. module: pos_odoo_driver_payment +#: model:ir.model.fields,field_description:pos_odoo_driver_payment.field_pos_payment_method__is_payment_terminal +msgid "Is Payment Terminal" +msgstr "Est un terminal de paiement" + +#. module: pos_odoo_driver_payment +#: model:ir.model.fields,field_description:pos_odoo_driver_payment.field_pos_config__iface_payment_terminal +#: model:ir.model.fields,field_description:pos_odoo_driver_payment.field_res_config_settings__pos_iface_payment_terminal +#: model_terms:ir.ui.view,arch_db:pos_odoo_driver_payment.view_res_config_settings_form +msgid "Payment Terminal" +msgstr "Terminal de paiement" + +#. module: pos_odoo_driver_payment +#: model:ir.model,name:pos_odoo_driver_payment.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuration du point de vente" + +#. module: pos_odoo_driver_payment +#: model:ir.model,name:pos_odoo_driver_payment.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "Modes de paiement du point de vente" + +#. module: pos_odoo_driver_payment +#: model:ir.model,name:pos_odoo_driver_payment.model_pos_session +msgid "Point of Sale Session" +msgstr "Session du point de vente" + +#. module: pos_odoo_driver_payment +#. odoo-javascript +#: code:addons/pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js:0 +#, python-format +msgid "" +"Possible reasons: \n" +"- the terminal payment is not connected\n" +"- the device is busy for the time being (still processing a payment)." +msgstr "" +"Raisons possibles: \n" +"- Le terminal de paiement n'est pas connecté\n" +"- Le périphérique est occupé pour le moment (déjà en train de traiter un paiement)" + +#. module: pos_odoo_driver_payment +#. odoo-javascript +#: code:addons/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml:0 +#: code:addons/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml:0 +#, python-format +msgid "Send to Payment Terminal" +msgstr "Envoyer au terminal de paiement" diff --git a/pos_odoo_driver_payment/models/__init__.py b/pos_odoo_driver_payment/models/__init__.py new file mode 100644 index 0000000..0772c66 --- /dev/null +++ b/pos_odoo_driver_payment/models/__init__.py @@ -0,0 +1,4 @@ +from . import pos_config +from . import res_config_settings +from . import pos_session +from . import pos_payment_method diff --git a/pos_odoo_driver_payment/models/pos_config.py b/pos_odoo_driver_payment/models/pos_config.py new file mode 100644 index 0000000..b2c4d92 --- /dev/null +++ b/pos_odoo_driver_payment/models/pos_config.py @@ -0,0 +1,23 @@ +# 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 api, fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + iface_payment_terminal = fields.Boolean( + "Payment Terminal", + help="A payment terminal is available on the Proxy", + compute="_compute_iface_payment_terminal", + store=True, + ) + + @api.depends("payment_method_ids.is_payment_terminal") + def _compute_iface_payment_terminal(self): + for config in self: + config.iface_payment_terminal = any( + config.mapped("payment_method_ids.is_payment_terminal") + ) diff --git a/pos_odoo_driver_payment/models/pos_payment_method.py b/pos_odoo_driver_payment/models/pos_payment_method.py new file mode 100644 index 0000000..8634567 --- /dev/null +++ b/pos_odoo_driver_payment/models/pos_payment_method.py @@ -0,0 +1,11 @@ +# 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 PosPaymentMethod(models.Model): + _inherit = "pos.payment.method" + + is_payment_terminal = fields.Boolean() diff --git a/pos_odoo_driver_payment/models/pos_session.py b/pos_odoo_driver_payment/models/pos_session.py new file mode 100644 index 0000000..364bf3f --- /dev/null +++ b/pos_odoo_driver_payment/models/pos_session.py @@ -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_payment_terminal"] + ) + return config diff --git a/pos_odoo_driver_payment/models/res_config_settings.py b/pos_odoo_driver_payment/models/res_config_settings.py new file mode 100644 index 0000000..a648df5 --- /dev/null +++ b/pos_odoo_driver_payment/models/res_config_settings.py @@ -0,0 +1,13 @@ +# 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_payment_terminal = fields.Boolean( + related="pos_config_id.iface_payment_terminal" + ) diff --git a/pos_odoo_driver_payment/readme/CONFIGURE.rst b/pos_odoo_driver_payment/readme/CONFIGURE.rst new file mode 100644 index 0000000..7adb536 --- /dev/null +++ b/pos_odoo_driver_payment/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +* go to the "Point of Sale > Configuration > Payment Method" + +* Check the option *Is Payment Terminal* + +.. figure:: ../static/img/pos_payment_method_form.png diff --git a/pos_odoo_driver_payment/readme/CONTRIBUTORS.rst b/pos_odoo_driver_payment/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..9c12cc3 --- /dev/null +++ b/pos_odoo_driver_payment/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +This module is a full refactor of the OCA V16 module ``pos_terminal_payment``. +Original authors and ideas are: + +* Aurelien Dumaine +* Alexis de Lattre +* Sylvain LE GAL (https://twitter.com/legalsylvain) diff --git a/pos_odoo_driver_payment/readme/DESCRIPTION.rst b/pos_odoo_driver_payment/readme/DESCRIPTION.rst new file mode 100644 index 0000000..c38311e --- /dev/null +++ b/pos_odoo_driver_payment/readme/DESCRIPTION.rst @@ -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 Telium Payment Terminal. + +More information: https://pypi.org/project/odoo-pos-driver/ diff --git a/pos_odoo_driver_payment/readme/USAGE.rst b/pos_odoo_driver_payment/readme/USAGE.rst new file mode 100644 index 0000000..996d280 --- /dev/null +++ b/pos_odoo_driver_payment/readme/USAGE.rst @@ -0,0 +1,7 @@ +* Open the Point of sale + +* make an order, and select a payment that is marked as "Is Payment Terminal" + +* Click on the button "Send to Payment Terminal" + +.. figure:: ../static/img/pos_front_end.png diff --git a/pos_odoo_driver_payment/static/description/pos_front_end.png b/pos_odoo_driver_payment/static/description/pos_front_end.png new file mode 100644 index 0000000000000000000000000000000000000000..56f4ce2dd67133fa288b5aff6283f25d9463ca51 GIT binary patch literal 4922 zcmZvgWmFVS)c+TelvqkyYDo#{?rvB@r9qVLZjfGSB$iZ`kZvTUL2`+80hdO)1*GA> zzc>GLp65I-X6C-QbLW2VnK?7_iPzInCB&z}2LJ$s>S{`00083)+Lpn^M)xi}@MZLX z=dSkF3jlaV`d`DCSqi-a07wtimE;Zm^A48+-Wbl^51(Gr$4p=-MOc$5+u{{5w~|Z` zwK@qUPJ^^t zPTe?xS6CPTAD4!LD&=?|{`N@vax(v{ZF|uRZq(p)W)uZfi1RJ2_rX9L-rA&c3b;(p z3QyECWDy6{-jHx^NUEFf&!|wwDv_V`ZRabgQc-^@fYcmW4?8W+ z)5Mmmy+ltTXRr)gTwHWEYq))FVWDF!|AKngft->O1Gp^vk%Yfqgck}FRR_fLmRnyX zB+zTyziCa>MEK5t4aDfefGI#y`cDK3Kyw|Hz`ev1sF=eZCcO;ctM!^zo)AU&XRi_4 z;7R}tQL7lfPNeJHRm6BMqL1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uhj7ES;3iWNp;3kGqJYEQ-3M%@H`$t3B*TF6rs%ab74YHUT*{atp3@vIhYg1`ZJBmNzXsy=D$Y9X*Vy zpc@A_YsO(h=~aYMTLI_l#h102*_oK83U`3$nV9x2m)4n90BY|87`+Uz?nsiz1Z9?p z)izp0;hozuU3ZUOXUHGeYghtF8{q!1u+I;~#O`JAN=~{wOY@CeU{$?ML-QQj0Ncvz z1=0u$U?zId8MC7_$@d|fkFbqFlQ#sw77l#Vy+5l3`sXyDt-FahgH`(qgBDnVkojF8 z69AO%J6^r25H4}zQGVtJvslG&H}JvrDJc;i9}J|3tgLv7@Y3b8N;w78l=HPd^)3cc-nhq#$gH3 zL_?K2%tAKvCLf2dv;Z@n=`CznNU9X{!?f?=9y&c#w_#61%AgYaVLf1RrfRR*ga|q8 z88klLUt&vnDmh$soBgWH{usOV%?Wvy=2EQISng&k-yjm9;B!#nrg$YMC{rf?1D8aZ mRLE)qR{KBRf0lZQ7aTZ<^M|Bb9PGb?C_Yz}E0Q&R_kRFD6}cY( literal 0 HcmV?d00001 diff --git a/pos_odoo_driver_payment/static/src/css/pos.css b/pos_odoo_driver_payment/static/src/css/pos.css new file mode 100644 index 0000000..fc59dcc --- /dev/null +++ b/pos_odoo_driver_payment/static/src/css/pos.css @@ -0,0 +1,7 @@ +div.send-payment-terminal-button { + font-size: x-large; + padding: 8px; + margin: 8px; + border: 2px solid gray; + border-radius: 10px; +} diff --git a/pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js b/pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js new file mode 100644 index 0000000..723cf44 --- /dev/null +++ b/pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js @@ -0,0 +1,39 @@ +// 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). + +odoo.define("pos_odoo_driver_payment.PaymentScreen", function (require) { + + const PaymentScreen = require("point_of_sale.PaymentScreen"); + const Registries = require("point_of_sale.Registries"); + const { useListener } = require("@web/core/utils/hooks"); + + const OverloadPaymentScreen = (OriginalPaymentScreen) => + class extends OriginalPaymentScreen { + + setup() { + super.setup(); + useListener('send-payment-terminal', this.SendPaymentTerminal); + } + + SendPaymentTerminal(event) { + var self = this; + const { cid } = event.detail; + const payment_line = this.paymentLines.find((line) => line.cid === cid); + this.env.proxy.payment_terminal_push_amount(payment_line) + .then(function (result) { + if (!result) { + self.showPopup('ErrorTracebackPopup', { + title: self.env._t('Communication failed'), + body: self.env._t('Possible reasons: \n- the terminal payment is not connected\n- the device is busy for the time being (still processing a payment).'), + }); + } + + }); + } + + }; + + Registries.Component.extend(PaymentScreen, OverloadPaymentScreen); + return PaymentScreen; +}); diff --git a/pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js b/pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js new file mode 100644 index 0000000..aad9cc1 --- /dev/null +++ b/pos_odoo_driver_payment/static/src/js/ProxyStatus.esm.js @@ -0,0 +1,37 @@ +// 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). + +odoo.define("pos_odoo_driver_payment.ProxyStatus", function (require) { + var Registries = require("point_of_sale.Registries"); + var ProxyStatus = require("point_of_sale.ProxyStatus"); + + const OverloadProxyStatus = (OriginalProxyStatus) => + class extends OriginalProxyStatus { + _setStatus(newStatus) { + super._setStatus(newStatus); + if ( + newStatus.status === "connected" && + this.env.pos.config.iface_payment_terminal + ) { + var paymentStatus = newStatus.drivers.payment + ? newStatus.drivers.payment.status + : false; + if ( + paymentStatus !== "connected" && + paymentStatus !== "connecting" + ) { + if (this.state.msg) { + this.state.msg = + this.env._t("EPT") + " & " + this.state.msg; + } else { + this.state.msg = this.env._t("EPT Offline"); + this.state.status = "warning"; + } + } + } + } + }; + + Registries.Component.extend(ProxyStatus, OverloadProxyStatus); +}); diff --git a/pos_odoo_driver_payment/static/src/js/devices.esm.js b/pos_odoo_driver_payment/static/src/js/devices.esm.js new file mode 100644 index 0000000..0202690 --- /dev/null +++ b/pos_odoo_driver_payment/static/src/js/devices.esm.js @@ -0,0 +1,23 @@ +// 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). + +odoo.define("pos_odoo_driver_payment.devices", function (require) { + + var ProxyDevice = require("point_of_sale.devices").ProxyDevice; + + ProxyDevice.include({ + + payment_terminal_push_amount: function (payment_line) { + var data = { + amount: payment_line.amount, + currency_iso: this.pos.currency.name, + }; + return this.message( + "payment_terminal_transaction_start", + {payment_info: JSON.stringify(data)} + ) + }, + + }); +}); diff --git a/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml b/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml new file mode 100644 index 0000000..6831397 --- /dev/null +++ b/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml @@ -0,0 +1,21 @@ + + + + + + + +
+ + +
+
+
+
+ +
diff --git a/pos_odoo_driver_payment/views/view_pos_payment_method.xml b/pos_odoo_driver_payment/views/view_pos_payment_method.xml new file mode 100644 index 0000000..e079dd9 --- /dev/null +++ b/pos_odoo_driver_payment/views/view_pos_payment_method.xml @@ -0,0 +1,19 @@ + + + + + + pos.payment.method + + + + + + + + + diff --git a/pos_odoo_driver_payment/views/view_res_config_settings.xml b/pos_odoo_driver_payment/views/view_res_config_settings.xml new file mode 100644 index 0000000..72314be --- /dev/null +++ b/pos_odoo_driver_payment/views/view_res_config_settings.xml @@ -0,0 +1,29 @@ + + + + + + res.config.settings + + + +
+
+
+
+
+ +
diff --git a/setup/pos_odoo_driver_payment/odoo/addons/pos_odoo_driver_payment b/setup/pos_odoo_driver_payment/odoo/addons/pos_odoo_driver_payment new file mode 120000 index 0000000..74ad0d2 --- /dev/null +++ b/setup/pos_odoo_driver_payment/odoo/addons/pos_odoo_driver_payment @@ -0,0 +1 @@ +../../../../pos_odoo_driver_payment \ No newline at end of file diff --git a/setup/pos_odoo_driver_payment/setup.py b/setup/pos_odoo_driver_payment/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/pos_odoo_driver_payment/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From ce9270502ab28494cd18febaff32a3596ef8e7ef Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 15 Oct 2024 13:20:23 +0200 Subject: [PATCH 2/2] [FIX] do not hardcode test regarding if payment method is a terminal --- pos_odoo_driver_payment/models/pos_config.py | 11 +---------- pos_odoo_driver_payment/models/pos_session.py | 5 +++++ pos_odoo_driver_payment/models/res_config_settings.py | 3 ++- .../static/src/xml/PaymentScreenPaymentLines.xml | 3 +-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/pos_odoo_driver_payment/models/pos_config.py b/pos_odoo_driver_payment/models/pos_config.py index b2c4d92..6f91cb9 100644 --- a/pos_odoo_driver_payment/models/pos_config.py +++ b/pos_odoo_driver_payment/models/pos_config.py @@ -2,7 +2,7 @@ # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import api, fields, models +from odoo import fields, models class PosConfig(models.Model): @@ -11,13 +11,4 @@ class PosConfig(models.Model): iface_payment_terminal = fields.Boolean( "Payment Terminal", help="A payment terminal is available on the Proxy", - compute="_compute_iface_payment_terminal", - store=True, ) - - @api.depends("payment_method_ids.is_payment_terminal") - def _compute_iface_payment_terminal(self): - for config in self: - config.iface_payment_terminal = any( - config.mapped("payment_method_ids.is_payment_terminal") - ) diff --git a/pos_odoo_driver_payment/models/pos_session.py b/pos_odoo_driver_payment/models/pos_session.py index 364bf3f..de21ed4 100644 --- a/pos_odoo_driver_payment/models/pos_session.py +++ b/pos_odoo_driver_payment/models/pos_session.py @@ -14,3 +14,8 @@ def _get_pos_ui_pos_config(self, params): config["is_posbox"] and config["iface_payment_terminal"] ) return config + + def _loader_params_pos_payment_method(self): + res = super()._loader_params_pos_payment_method() + res["search_params"]["fields"] += ["is_payment_terminal"] + return res diff --git a/pos_odoo_driver_payment/models/res_config_settings.py b/pos_odoo_driver_payment/models/res_config_settings.py index a648df5..67e1d6c 100644 --- a/pos_odoo_driver_payment/models/res_config_settings.py +++ b/pos_odoo_driver_payment/models/res_config_settings.py @@ -9,5 +9,6 @@ class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" pos_iface_payment_terminal = fields.Boolean( - related="pos_config_id.iface_payment_terminal" + related="pos_config_id.iface_payment_terminal", + readonly=False, ) diff --git a/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml b/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml index 6831397..29c2d75 100644 --- a/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml +++ b/pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml @@ -5,8 +5,7 @@ t-inherit="point_of_sale.PaymentScreenPaymentLines" t-inherit-mode="extension" owl="1"> - - +