-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
24 changed files
with
399 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import pos_config | ||
from . import res_config_settings | ||
from . import pos_session | ||
from . import pos_payment_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 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 PosConfig(models.Model): | ||
_inherit = "pos.config" | ||
|
||
iface_payment_terminal = fields.Boolean( | ||
"Payment Terminal", | ||
help="A payment terminal is available on the Proxy", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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 | ||
|
||
def _loader_params_pos_payment_method(self): | ||
res = super()._loader_params_pos_payment_method() | ||
res["search_params"]["fields"] += ["is_payment_terminal"] | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 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", | ||
readonly=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* Sylvain LE GAL (https://twitter.com/legalsylvain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 Telium Payment Terminal. | ||
|
||
More information: https://pypi.org/project/odoo-pos-driver/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.92 KB
pos_odoo_driver_payment/static/description/pos_payment_method_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
div.send-payment-terminal-button { | ||
font-size: x-large; | ||
padding: 8px; | ||
margin: 8px; | ||
border: 2px solid gray; | ||
border-radius: 10px; | ||
} |
39 changes: 39 additions & 0 deletions
39
pos_odoo_driver_payment/static/src/js/PaymentScreen.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)} | ||
) | ||
}, | ||
|
||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
pos_odoo_driver_payment/static/src/xml/PaymentScreenPaymentLines.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t t-name="pos_odoo_driver_payment.PaymentScreenPaymentLines" | ||
t-inherit="point_of_sale.PaymentScreenPaymentLines" | ||
t-inherit-mode="extension" owl="1"> | ||
<xpath expr="//div[hasclass('payment-name')]" position="after"> | ||
<t t-if="line.payment_method.is_payment_terminal"> | ||
<div class="send-payment-terminal-button" | ||
t-on-click="() => this.trigger('send-payment-terminal', { cid: line.cid })" | ||
aria-label="Send to Payment Terminal" | ||
title="Send to Payment Terminal"> | ||
<i class="fa fa-credit-card" /> | ||
<i class="fa fa-share-square" /> | ||
</div> | ||
</t> | ||
</xpath> | ||
</t> | ||
|
||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
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> | ||
|
||
<record id="view_pos_payment_method_form" model="ir.ui.view"> | ||
<field name="model">pos.payment.method</field> | ||
<field name="inherit_id" ref="point_of_sale.pos_payment_method_view_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="journal_id" position="after"> | ||
<field name="is_payment_terminal"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
Oops, something went wrong.