diff --git a/pos_payment_method_cashdro/README.rst b/pos_payment_method_cashdro/README.rst new file mode 100644 index 0000000000..1ee8ed6e9e --- /dev/null +++ b/pos_payment_method_cashdro/README.rst @@ -0,0 +1,122 @@ +========================== +PoS Payment Method CashDro +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/12.0/pos_payment_method_cashdro + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-12-0/pos-12-0-pos_payment_method_cashdro + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to make payments with a Cashdro (https://www.cashdro.com) terminal +on the Point of Sale frontend. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Go to a Point of Sale cash payment method or create a new one. +#. In the Point of Sale tab, set *Cashdro Payment Terminal* on. +#. Configure the Cashdro terminal hostname and credentials. +#. Configure the desired, Cashdro terminal in the proper PoS configurations. + +Note that if a single payment method was used for cash in different stores, it should +be splitted in as many phisical stores there are. + +Usage +===== + +With the proper configuration made: + +#. Make a new PoS order and choose the cash payment method configured with the Cashdro + settings. +#. In the payment line, tap on the Cashdro request button (the one with a bill icon). +#. The request is sent to the Cashdro terminal that will ask the customer for the amount + to pay. +#. In this moment, a button with a ban icon will appear. It allows the cashier to cancel + the request before the payment is made. +#. When the customer pays the sale amount in the terminal, the Cashdro reports the + amount received and change delivered back. +#. The Point of Sale reflects it in the payment line and thus the order can be validated + now. + +Known issues / Roadmap +====================== + +* Cashdro terminals are designed to communicate in the local network, so they can't + receive or transmit any request to a remote Odoo server. So in order to implement + further features, la cash control or cash ins/outs it would be necessary to either: + + - Prepare the Cashdro terminal for a remote use (VPN, dns, etc.) and implement the + corresponding backend methods. + - Develope PoS frontend modules that allow to perform such operations and extend this + one making use of them. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Acysos S.L. `_: + + * Ignacio Ibeas + +* `Tecnativa `_ + + * David Vidal + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_payment_method_cashdro/__init__.py b/pos_payment_method_cashdro/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_payment_method_cashdro/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_payment_method_cashdro/__manifest__.py b/pos_payment_method_cashdro/__manifest__.py new file mode 100644 index 0000000000..7d387eb623 --- /dev/null +++ b/pos_payment_method_cashdro/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "PoS Payment Method CashDro", + "summary": "Allows to pay with CashDro Terminals on the Point of Sale", + "version": "12.0.1.0.0", + "category": "Point Of Sale", + "website": "https://github.com/OCA/pos", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "point_of_sale", + ], + "data": [ + "views/assets.xml", + "views/account_journal.xml", + ], + "qweb": ["static/src/xml/pos_cashdro_terminal.xml"], + "installable": True, +} diff --git a/pos_payment_method_cashdro/i18n/pos_payment_method_cashdro.pot b/pos_payment_method_cashdro/i18n/pos_payment_method_cashdro.pot new file mode 100644 index 0000000000..3e06e18881 --- /dev/null +++ b/pos_payment_method_cashdro/i18n/pos_payment_method_cashdro.pot @@ -0,0 +1,85 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_method_cashdro +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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_payment_method_cashdro +#. openerp-web +#: code:addons/pos_payment_method_cashdro/static/src/xml/pos_cashdro_terminal.xml:16 +#, python-format +msgid "Cancel transaction" +msgstr "" + +#. module: pos_payment_method_cashdro +#. openerp-web +#: code:addons/pos_payment_method_cashdro/static/src/js/screens.js:206 +#, python-format +msgid "CashDro Error" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_bank_statement_import_journal_creation__cashdro_password +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_journal__cashdro_password +msgid "Cashdro Password" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_bank_statement_import_journal_creation__cashdro_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_journal__cashdro_payment_terminal +msgid "Cashdro Payment Terminal" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_bank_statement_import_journal_creation__cashdro_host +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_journal__cashdro_host +msgid "Cashdro Terminal Host Name or IP address" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_bank_statement_import_journal_creation__cashdro_user +#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_account_journal__cashdro_user +msgid "Cashdro User" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model.fields,help:pos_payment_method_cashdro.field_account_bank_statement_import_journal_creation__cashdro_host +#: model:ir.model.fields,help:pos_payment_method_cashdro.field_account_journal__cashdro_host +msgid "It must be reachable by the PoS in the store" +msgstr "" + +#. module: pos_payment_method_cashdro +#: model:ir.model,name:pos_payment_method_cashdro.model_account_journal +msgid "Journal" +msgstr "" + +#. module: pos_payment_method_cashdro +#. openerp-web +#: code:addons/pos_payment_method_cashdro/static/src/xml/pos_cashdro_terminal.xml:21 +#, python-format +msgid "Start transaction" +msgstr "" + +#. module: pos_payment_method_cashdro +#. openerp-web +#: code:addons/pos_payment_method_cashdro/static/src/js/screens.js:231 +#, python-format +msgid "There is a transaction in progress, would you like to cancel it?" +msgstr "" + +#. module: pos_payment_method_cashdro +#. openerp-web +#: code:addons/pos_payment_method_cashdro/static/src/js/screens.js:230 +#, python-format +msgid "Transaction ongoing" +msgstr "" + diff --git a/pos_payment_method_cashdro/models/__init__.py b/pos_payment_method_cashdro/models/__init__.py new file mode 100644 index 0000000000..2388e11968 --- /dev/null +++ b/pos_payment_method_cashdro/models/__init__.py @@ -0,0 +1 @@ +from . import account_journal diff --git a/pos_payment_method_cashdro/models/account_journal.py b/pos_payment_method_cashdro/models/account_journal.py new file mode 100644 index 0000000000..27355a71f7 --- /dev/null +++ b/pos_payment_method_cashdro/models/account_journal.py @@ -0,0 +1,17 @@ +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + # TODO: In 13.0 this fields should be moved to `pos.payment.method` + # and be addod to the payment terminal selection + + cashdro_payment_terminal = fields.Boolean() + cashdro_host = fields.Char( + string="Cashdro Terminal Host Name or IP address", + help="It must be reachable by the PoS in the store", + ) + cashdro_user = fields.Char(string="Cashdro User") + cashdro_password = fields.Char(string="Cashdro Password") diff --git a/pos_payment_method_cashdro/readme/CONFIGURE.rst b/pos_payment_method_cashdro/readme/CONFIGURE.rst new file mode 100644 index 0000000000..9e852c14d5 --- /dev/null +++ b/pos_payment_method_cashdro/readme/CONFIGURE.rst @@ -0,0 +1,9 @@ +To configure this module, you need to: + +#. Go to a Point of Sale cash payment method or create a new one. +#. In the Point of Sale tab, set *Cashdro Payment Terminal* on. +#. Configure the Cashdro terminal hostname and credentials. +#. Configure the desired, Cashdro terminal in the proper PoS configurations. + +Note that if a single payment method was used for cash in different stores, it should +be splitted in as many phisical stores there are. diff --git a/pos_payment_method_cashdro/readme/CONTRIBUTORS.rst b/pos_payment_method_cashdro/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..0ea3f5e5f9 --- /dev/null +++ b/pos_payment_method_cashdro/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* `Acysos S.L. `_: + + * Ignacio Ibeas + +* `Tecnativa `_ + + * David Vidal diff --git a/pos_payment_method_cashdro/readme/DESCRIPTION.rst b/pos_payment_method_cashdro/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..f62178e48d --- /dev/null +++ b/pos_payment_method_cashdro/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to make payments with a Cashdro (https://www.cashdro.com) terminal +on the Point of Sale frontend. diff --git a/pos_payment_method_cashdro/readme/ROADMAP.rst b/pos_payment_method_cashdro/readme/ROADMAP.rst new file mode 100644 index 0000000000..41a1ddb7bd --- /dev/null +++ b/pos_payment_method_cashdro/readme/ROADMAP.rst @@ -0,0 +1,8 @@ +* Cashdro terminals are designed to communicate in the local network, so they can't + receive or transmit any request to a remote Odoo server. So in order to implement + further features, la cash control or cash ins/outs it would be necessary to either: + + - Prepare the Cashdro terminal for a remote use (VPN, dns, etc.) and implement the + corresponding backend methods. + - Develope PoS frontend modules that allow to perform such operations and extend this + one making use of them. diff --git a/pos_payment_method_cashdro/readme/USAGE.rst b/pos_payment_method_cashdro/readme/USAGE.rst new file mode 100644 index 0000000000..f2eeaece7c --- /dev/null +++ b/pos_payment_method_cashdro/readme/USAGE.rst @@ -0,0 +1,13 @@ +With the proper configuration made: + +#. Make a new PoS order and choose the cash payment method configured with the Cashdro + settings. +#. In the payment line, tap on the Cashdro request button (the one with a bill icon). +#. The request is sent to the Cashdro terminal that will ask the customer for the amount + to pay. +#. In this moment, a button with a ban icon will appear. It allows the cashier to cancel + the request before the payment is made. +#. When the customer pays the sale amount in the terminal, the Cashdro reports the + amount received and change delivered back. +#. The Point of Sale reflects it in the payment line and thus the order can be validated + now. diff --git a/pos_payment_method_cashdro/static/description/icon.png b/pos_payment_method_cashdro/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_payment_method_cashdro/static/description/icon.png differ diff --git a/pos_payment_method_cashdro/static/description/index.html b/pos_payment_method_cashdro/static/description/index.html new file mode 100644 index 0000000000..74e46ed809 --- /dev/null +++ b/pos_payment_method_cashdro/static/description/index.html @@ -0,0 +1,473 @@ + + + + + + +PoS Payment Method CashDro + + + +
+

PoS Payment Method CashDro

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

This module allows to make payments with a Cashdro (https://www.cashdro.com) terminal +on the Point of Sale frontend.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to a Point of Sale cash payment method or create a new one.
  2. +
  3. In the Point of Sale tab, set Cashdro Payment Terminal on.
  4. +
  5. Configure the Cashdro terminal hostname and credentials.
  6. +
  7. Configure the desired, Cashdro terminal in the proper PoS configurations.
  8. +
+

Note that if a single payment method was used for cash in different stores, it should +be splitted in as many phisical stores there are.

+
+
+

Usage

+

With the proper configuration made:

+
    +
  1. Make a new PoS order and choose the cash payment method configured with the Cashdro +settings.
  2. +
  3. In the payment line, tap on the Cashdro request button (the one with a bill icon).
  4. +
  5. The request is sent to the Cashdro terminal that will ask the customer for the amount +to pay.
  6. +
  7. In this moment, a button with a ban icon will appear. It allows the cashier to cancel +the request before the payment is made.
  8. +
  9. When the customer pays the sale amount in the terminal, the Cashdro reports the +amount received and change delivered back.
  10. +
  11. The Point of Sale reflects it in the payment line and thus the order can be validated +now.
  12. +
+
+
+

Known issues / Roadmap

+
    +
  • Cashdro terminals are designed to communicate in the local network, so they can’t +receive or transmit any request to a remote Odoo server. So in order to implement +further features, la cash control or cash ins/outs it would be necessary to either:
      +
    • Prepare the Cashdro terminal for a remote use (VPN, dns, etc.) and implement the +corresponding backend methods.
    • +
    • Develope PoS frontend modules that allow to perform such operations and extend this +one making use of them.
    • +
    +
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_payment_method_cashdro/static/description/logo.png b/pos_payment_method_cashdro/static/description/logo.png new file mode 100644 index 0000000000..e12c033db5 Binary files /dev/null and b/pos_payment_method_cashdro/static/description/logo.png differ diff --git a/pos_payment_method_cashdro/static/src/js/models.js b/pos_payment_method_cashdro/static/src/js/models.js new file mode 100644 index 0000000000..139ec131d8 --- /dev/null +++ b/pos_payment_method_cashdro/static/src/js/models.js @@ -0,0 +1,20 @@ +odoo.define("pos_payment_method_cashdro.models", function (require) { + "use strict"; + + var models = require("point_of_sale.models"); + + models.load_fields( + "account.journal", + ["cashdro_payment_terminal", "cashdro_host", "cashdro_user", "cashdro_password"] + ); + + var order_super = models.Order.prototype; + + models.Order = models.Order.extend({ + initialize: function(){ + order_super.initialize.apply(this, arguments); + this.in_cashdro_transaction = false; + }, + }); + +}); diff --git a/pos_payment_method_cashdro/static/src/js/screens.js b/pos_payment_method_cashdro/static/src/js/screens.js new file mode 100644 index 0000000000..33436e9047 --- /dev/null +++ b/pos_payment_method_cashdro/static/src/js/screens.js @@ -0,0 +1,243 @@ +odoo.define("pos_payment_method_cashdro.screens", function (require) { + "use strict"; + + var screens = require("point_of_sale.screens"); + var core = require("web.core"); + + + screens.PaymentScreenWidget.include({ + + render_paymentlines : function(){ + this._super.apply(this, arguments); + var _this = this; + this.$(".paymentlines-container").unbind("click").on( + "click", ".cashdro-transaction-start", + function (ev) { + _this.pos.get_order().in_cashdro_transaction = true; + _this.order_changes(); + _this.journal = _this._get_journal($(this).data('cid')); + _this.cashdro_send_payment_request().done(function () { + _this.pos.get_order().in_cashdro_transaction = false; + var amount = _this.pos.get_order().selected_paymentline.amount; + _this.order_changes(); + _this.render_paymentlines(); + _this.$('.paymentline.selected .edit').text(_this.format_currency_no_symbol(amount)); + }); + }).on( + "click", ".cashdro-transaction-cancel", + function (ev) { + _this.pos.get_order().in_cashdro_transaction = false; + _this.order_changes(); + _this.journal = _this._get_journal($(this).data('cid')); + _this.cashdro_finish_operation(_this.pos.get_order().cashdro_operation); + } + ); + }, + + order_changes: function(){ + this._super.apply(this, arguments); + var order = this.pos.get_order(); + if (!order) { + return; + } else if (order.in_cashdro_transaction) { + this.$('.next').addClass('oe_hidden'); + this.$('.in_cashdro_transaction').removeClass('oe_hidden'); + this.$('.cashdro-transaction-start').addClass('oe_hidden'); + this.$('.cashdro-transaction-cancel').removeClass('oe_hidden'); + } else { + this.$('.next').removeClass('oe_hidden'); + this.$('.in_cashdro_transaction').addClass('oe_hidden'); + this.$('.cashdro-transaction-start').removeClass('oe_hidden'); + this.$('.cashdro-transaction-cancel').addClass('oe_hidden'); + } + }, + + cashdro_send_payment_request: function () { + // The payment is done in three concatenated steps: + // 1. The POS send a payment request, to which the Cashdro respondes + // with an operation id. + // 2. Then the POS has to acknowledge that such operation id has + // been received. + // 3. Once acknowledged the POS has to send a payment request to the + // cashdro. Once the Cashdro responses with a "F" state (for + // finished) we'll get the response and fill the tendered money + // for the payment line. + var _this = this; + var order = this.pos.get_order() + var payment_line = order.selected_paymentline; + // Cashdro treats decimals as positions in an integer we also have + // to deal with floating point computing to avoid decimals at the + // end or the drawer will reject our request. + var amount = parseInt(order.get_due(payment_line).toFixed(2) * 100); + var url = this._cashdro_payment_url({"amount": amount}); + var operation_id = ""; + var request = this._cashdro_request(url) + .then(function (res) { + // It comes handy to log the response from the drawer, as + // we can diagnose the right sytmoms for each issue + console.log(res); + operation_id = res.data; + _this.pos.get_order().cashdro_operation = operation_id; + // Acknowledge the operation + var ack_url = _this._cashdro_ack_url(operation_id); + return _this._cashdro_request(ack_url); + }) + .then(function (res_ack) { + // Validate the operation + console.log(res_ack); + var ask_url = _this._cashdro_ask_url(operation_id); + return _this._cashdro_request_payment(ask_url); + }) + .then(function (operation_data) { + // This might be too verbose, but it helps a lot to diagnose + // issues and their reasons. + console.log(operation_data); + var data = JSON.parse(operation_data.data); + payment_line.cashdro_operation_data = data; + _this.pos.get_order().in_cashdro_transaction = false; + var tendered = data.operation.totalin / 100; + payment_line.set_amount(tendered) + }); + return request; + }, + + cashdro_finish_operation: function (operation) { + // Finish the Cashdro running operation + var _this = this + var order = this.pos.get_order() + if (operation) { + this._cashdro_request(this._cashdro_finish_url(operation)) + .then(function () { + order.in_cashdro_transaction = false; + order.cashdro_operation = false; + order.in_cashdro_transaction = false; + _this.order_changes(); + }); + } + }, + + // API communication methods + + _cashdro_url: function () { + // Cashdro machines don't support safe POST calls, so we're sending + // all the data quite unsafely constantly... + var cashdro_host = this.journal && this.journal.cashdro_host; + if (!cashdro_host) { + return false; + } + var url = "https://" + cashdro_host + "/Cashdro3WS/index.php?"; + url += "name=" + this.journal.cashdro_user; + url += "&password=" + this.journal.cashdro_password; + return url; + }, + + _cashdro_payment_url: function(parameters) { + // Compose the url for a sale report to Cashdro + var url = this._cashdro_url() + url += "&operation=startOperation&type=4"; + url += "&posid=pos-" + this.pos.pos_session.name; + url += "&posuser=" + this.pos.get_cashier().id; + url += "¶meters=" + JSON.stringify(parameters); + return url; + }, + + _cashdro_ack_url: function(operation_id) { + // Compose the url for a sale report to Cashdro + var url = this._cashdro_url() + url += "&operation=acknowledgeOperationId"; + url += "&operationId=" + operation_id; + return url; + }, + + _cashdro_ask_url: function(operation_id) { + // Compose the url for to report a sale to Cashdro + var url = this._cashdro_url() + url += "&operation=askOperation"; + url += "&operationId=" + operation_id; + return url; + }, + + _cashdro_finish_url: function(operation_id) { + // Compose the url for a sale report to Cashdro + var url = this._cashdro_url() + url += "&operation=finishOperation&type=2"; + url += "&operationId=" + operation_id; + return url; + }, + + _cashdro_request: function (url) { + // We'll use it for regular requests + return $.ajax({ + url: url, + method: "GET", + async: true, + success: function (response) { + return response; + } + }); + }, + + _cashdro_request_payment: function (url) { + // This is a special request, as we keep requesting the CashDro + // until we get the *finished* state that will give us the amount + // received in the cashdrawer. + var def = $.Deferred(); + var _request_payment = function(url) { + $.ajax({ + url: url, + method: "GET", + success: function (response) { + var data = JSON.parse(response.data); + if (data.operation.state === "F") { + def.resolve(response); + } else { + _request_payment(url); + } + } + }); + } + _request_payment(url); + return def; + }, + + + _show_error: function (msg, title) { + if (!title) { + title = _t("CashDro Error"); + } + this.pos.gui.show_popup("error", { + "title": title, + "body": msg, + }); + }, + + // These methods should be covered in v13 with the new payment methods + + _get_journal: function (line_cid) { + var line; + var order = this.pos.get_order(); + var lines = order.get_paymentlines(); + for ( var i = 0; i < lines.length; i++ ) { + if (lines[i].cid === line_cid) { + line = lines[i]; + } + } + return line.cashregister.journal + }, + _cancel_current_transaction_popup: function () { + var self = this; + this.gui.show_popup("confirm",{ + title: _t("Transaction ongoing"), + body: _t("There is a transaction in progress, would you like to cancel it?"), + confirm: function () { + self._cancel_current_transaction() + }, + cancel: function () { + return; + } + }); + }, + + }); + +}); diff --git a/pos_payment_method_cashdro/static/src/scss/pos_cashdro_terminal.scss b/pos_payment_method_cashdro/static/src/scss/pos_cashdro_terminal.scss new file mode 100644 index 0000000000..353b1aa773 --- /dev/null +++ b/pos_payment_method_cashdro/static/src/scss/pos_cashdro_terminal.scss @@ -0,0 +1,7 @@ +button.cashdro-transaction-start, button.cashdro-transaction-cancel { + /*Same css values as ".screen .top-content .button" */ + font-size: 20px; + padding: 3px 13px; + line-height: 32px; + border-radius: 3px; +} diff --git a/pos_payment_method_cashdro/static/src/xml/pos_cashdro_terminal.xml b/pos_payment_method_cashdro/static/src/xml/pos_cashdro_terminal.xml new file mode 100644 index 0000000000..2e2838c079 --- /dev/null +++ b/pos_payment_method_cashdro/static/src/xml/pos_cashdro_terminal.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/pos_payment_method_cashdro/views/account_journal.xml b/pos_payment_method_cashdro/views/account_journal.xml new file mode 100644 index 0000000000..a6d877e6c8 --- /dev/null +++ b/pos_payment_method_cashdro/views/account_journal.xml @@ -0,0 +1,17 @@ + + + + account.journal + + + + + + + + + + + + + diff --git a/pos_payment_method_cashdro/views/assets.xml b/pos_payment_method_cashdro/views/assets.xml new file mode 100644 index 0000000000..7fa28e9305 --- /dev/null +++ b/pos_payment_method_cashdro/views/assets.xml @@ -0,0 +1,10 @@ + + +