Skip to content

Commit

Permalink
Merge PR #1218 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Dec 15, 2024
2 parents 5c70694 + d17a0b0 commit b4172fe
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pos_payment_terminal/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ msgid ""
"transaction."
msgstr ""

#. module: pos_payment_terminal
#. odoo-javascript
#: code:addons/pos_payment_terminal/static/src/js/models.js:0
#, python-format
msgid ""
"A payment terminal has been linked to one payment provider but the IoT "
"Box location has not been configured."
msgstr "Un terminal de paiement a été lié à une méthode de paiement mais l'emplacement "
"de l'IoT Box n'a pas ếté configuré."

#. module: pos_payment_terminal
#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method
msgid "Point of Sale Payment Methods"
Expand Down
9 changes: 9 additions & 0 deletions pos_payment_terminal/i18n/pos_payment_terminal.pot
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ msgid ""
"transaction."
msgstr ""

#. module: pos_payment_terminal
#. odoo-javascript
#: code:addons/pos_payment_terminal/static/src/js/models.js:0
#, python-format
msgid ""
"A payment terminal has been linked to one payment provider but the IoT "
"Box location has not been configured."
msgstr ""

#. module: pos_payment_terminal
#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method
msgid "Point of Sale Payment Methods"
Expand Down
23 changes: 21 additions & 2 deletions pos_payment_terminal/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,44 @@
odoo.define("pos_payment_terminal.models", function (require) {
"use strict";

var core = require("web.core");
var models = require("point_of_sale.models");
const {PosGlobalState, Payment} = require("point_of_sale.models");
const Registries = require("point_of_sale.Registries");

var _t = core._t;

var OCAPaymentTerminal = require("pos_payment_terminal.payment");
models.register_payment_method("oca_payment_terminal", OCAPaymentTerminal);

const PosPaymentTerminalPosGlobalState = (OriginalPosGlobalState) =>
class extends OriginalPosGlobalState {
// @override
async after_load_server_data() {
for (var payment_method_id in this.payment_methods) {
var payment_method = this.payment_methods[payment_method_id];
for (var index in this.payment_methods) {
var payment_method = this.payment_methods[index];
var payment_method_id = payment_method.id;
if (
this.config.payment_method_ids.indexOf(payment_method_id) === -1
) {
continue;
}
if (
payment_method.use_payment_terminal === "oca_payment_terminal"
) {
this.config.use_proxy = true;
}
}
if (Boolean(!this.config.proxy_ip) && this.config.use_proxy) {
throw new Error(_t("Payment Terminal Error"), {
cause: {
message: _t(
"A payment terminal has been linked to one payment provider but the IoT " +
"Box location has not been configured."
),
},
});
}
return await super.after_load_server_data(...arguments);
}
};
Expand Down

0 comments on commit b4172fe

Please sign in to comment.