diff --git a/pos_payment_terminal/__manifest__.py b/pos_payment_terminal/__manifest__.py index dfa8a3a5..f1e60cda 100644 --- a/pos_payment_terminal/__manifest__.py +++ b/pos_payment_terminal/__manifest__.py @@ -7,15 +7,16 @@ 'version': '12.0.0.1.1', 'category': 'Point Of Sale', 'summary': 'Manage Payment Terminal device from POS front end', - 'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", + 'author': "Aurélien DUMAINE,GRAP,Akretion," + "Odoo Community Association (OCA)", 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ 'views/pos_config.xml', 'views/account_journal.xml', - 'views/pos_payment_terminal_template.xml', + 'views/assets.xml', ], - 'demo': ['demo/pos_payment_terminal_demo.xml'], + 'demo': ['demo/pos_config.xml'], 'qweb': ['static/src/xml/pos_payment_terminal.xml'], 'installable': True, } diff --git a/pos_payment_terminal/demo/pos_config.xml b/pos_payment_terminal/demo/pos_config.xml new file mode 100644 index 00000000..8388c36a --- /dev/null +++ b/pos_payment_terminal/demo/pos_config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/pos_payment_terminal/demo/pos_payment_terminal_demo.xml b/pos_payment_terminal/demo/pos_payment_terminal_demo.xml deleted file mode 100644 index fb3dbd39..00000000 --- a/pos_payment_terminal/demo/pos_payment_terminal_demo.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/pos_payment_terminal/i18n/fr.po b/pos_payment_terminal/i18n/fr.po index cc5f61ab..3f7250bc 100644 --- a/pos_payment_terminal/i18n/fr.po +++ b/pos_payment_terminal/i18n/fr.po @@ -1,23 +1,24 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * pos_payment_terminal +# * pos_payment_terminal # -# Translators: -# OCA Transbot , 2017 -# leemannd , 2017 msgid "" msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-01 02:01+0000\n" -"PO-Revision-Date: 2018-03-01 02:01+0000\n" -"Last-Translator: leemannd , 2017\n" -"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" -"Language: fr\n" +"POT-Creation-Date: 2020-01-18 10:52+0000\n" +"PO-Revision-Date: 2020-01-18 10:52+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: nplurals=2; plural=(n > 1);\n" +"Plural-Forms: \n" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_config__iface_payment_terminal +msgid "A payment terminal is available on the Proxy" +msgstr "Un terminal de paiment est disponible sur le proxy" #. module: pos_payment_terminal #: selection:account.journal,payment_mode:0 @@ -35,17 +36,28 @@ msgid "Journal" msgstr "Journal" #. module: pos_payment_terminal -#: model:ir.model.fields,field_description:pos_payment_terminal.field_account_journal_payment_mode +#: model:ir.model.fields,field_description:pos_payment_terminal.field_account_journal__payment_mode msgid "Payment Mode" msgstr "Moyen de paiement" +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_config__iface_payment_terminal +#: model_terms:ir.ui.view,arch_db:pos_payment_terminal.view_pos_config_form +msgid "Payment Terminal" +msgstr "Terminal de paiement" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Paramétrage du point de vente" + #. module: pos_payment_terminal #: model:ir.model,name:pos_payment_terminal.model_pos_order msgid "Point of Sale Orders" -msgstr "" +msgstr "Commandes du point de vente" #. module: pos_payment_terminal -#: model:ir.model.fields,help:pos_payment_terminal.field_account_journal_payment_mode +#: model:ir.model.fields,help:pos_payment_terminal.field_account_journal__payment_mode msgid "Select the payment mode sent to the payment terminal" msgstr "Sélectionner le mode de paiement envoyé au terminal de paiement" @@ -55,8 +67,3 @@ msgstr "Sélectionner le mode de paiement envoyé au terminal de paiement" #, python-format msgid "Start transaction" msgstr "Démarrer la transaction" - -#. module: pos_payment_terminal -#: model:ir.model,name:pos_payment_terminal.model_pos_config -msgid "pos.config" -msgstr "pos.config" diff --git a/pos_payment_terminal/i18n/pos_payment_terminal.pot b/pos_payment_terminal/i18n/pos_payment_terminal.pot index 3883db26..baf366ee 100644 --- a/pos_payment_terminal/i18n/pos_payment_terminal.pot +++ b/pos_payment_terminal/i18n/pos_payment_terminal.pot @@ -1,11 +1,13 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * pos_payment_terminal +# * pos_payment_terminal # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-01-18 10:55+0000\n" +"PO-Revision-Date: 2020-01-18 10:55+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -13,6 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_config__iface_payment_terminal +msgid "A payment terminal is available on the Proxy" +msgstr "" + #. module: pos_payment_terminal #: selection:account.journal,payment_mode:0 msgid "Card" @@ -29,17 +36,28 @@ msgid "Journal" msgstr "" #. module: pos_payment_terminal -#: model:ir.model.fields,field_description:pos_payment_terminal.field_account_journal_payment_mode +#: model:ir.model.fields,field_description:pos_payment_terminal.field_account_journal__payment_mode msgid "Payment Mode" msgstr "" +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_config__iface_payment_terminal +#: model_terms:ir.ui.view,arch_db:pos_payment_terminal.view_pos_config_form +msgid "Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + #. module: pos_payment_terminal #: model:ir.model,name:pos_payment_terminal.model_pos_order msgid "Point of Sale Orders" msgstr "" #. module: pos_payment_terminal -#: model:ir.model.fields,help:pos_payment_terminal.field_account_journal_payment_mode +#: model:ir.model.fields,help:pos_payment_terminal.field_account_journal__payment_mode msgid "Select the payment mode sent to the payment terminal" msgstr "" @@ -49,9 +67,3 @@ msgstr "" #, python-format msgid "Start transaction" msgstr "" - -#. module: pos_payment_terminal -#: model:ir.model,name:pos_payment_terminal.model_pos_config -msgid "pos.config" -msgstr "" - diff --git a/pos_payment_terminal/models/account_journal.py b/pos_payment_terminal/models/account_journal.py index 84853a9c..84080a1a 100644 --- a/pos_payment_terminal/models/account_journal.py +++ b/pos_payment_terminal/models/account_journal.py @@ -2,7 +2,6 @@ # © 2015-2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from odoo import models, fields diff --git a/pos_payment_terminal/models/pos_order.py b/pos_payment_terminal/models/pos_order.py index d00f1e98..1d6dcebe 100644 --- a/pos_payment_terminal/models/pos_order.py +++ b/pos_payment_terminal/models/pos_order.py @@ -1,9 +1,10 @@ # © 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + from collections import defaultdict import logging -from odoo import models, api +from odoo import api, models _logger = logging.getLogger(__name__) diff --git a/pos_payment_terminal/readme/CONFIGURE.rst b/pos_payment_terminal/readme/CONFIGURE.rst index b3a26cb1..8fa91aa0 100644 --- a/pos_payment_terminal/readme/CONFIGURE.rst +++ b/pos_payment_terminal/readme/CONFIGURE.rst @@ -1,4 +1,11 @@ +* Go to Point of Sale > Configuration > Point of Sale, and check + the field "Payment Terminal" -This module support two payment modes : *card* and *check*. The payment -mode should be configured on the main Odoo server, in the menu *Point -of Sale > Configuration > Payment Methods*, under the *Point of Sale* tab. +.. figure:: ../static/description/pos_config_form.png + +* Then, in the same point of sale form, click on "Payment Methods" to + set correctly your account journals. + This module support two payment modes : *card* and *check*, this + option is available in te Point of sale tab. + +.. figure:: ../static/description/account_journal_form.png diff --git a/pos_payment_terminal/readme/CONTRIBUTORS.rst b/pos_payment_terminal/readme/CONTRIBUTORS.rst index 5e00e970..2246ef2f 100644 --- a/pos_payment_terminal/readme/CONTRIBUTORS.rst +++ b/pos_payment_terminal/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Aurelien Dumaine * Alexis de Lattre +* Sylvain LE GAL (https://twitter.com/legalsylvain) diff --git a/pos_payment_terminal/static/description/account_journal_form.png b/pos_payment_terminal/static/description/account_journal_form.png new file mode 100644 index 00000000..c7484bd0 Binary files /dev/null and b/pos_payment_terminal/static/description/account_journal_form.png differ diff --git a/pos_payment_terminal/static/description/pos_config.png b/pos_payment_terminal/static/description/pos_config.png new file mode 100644 index 00000000..bb45b504 Binary files /dev/null and b/pos_payment_terminal/static/description/pos_config.png differ diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/devices.js old mode 100755 new mode 100644 similarity index 58% rename from pos_payment_terminal/static/src/js/pos_payment_terminal.js rename to pos_payment_terminal/static/src/js/devices.js index 00f84b01..a46d074b --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/devices.js @@ -7,19 +7,13 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { +odoo.define('pos_payment_terminal.devices', function (require) { "use strict"; - var screens = require('point_of_sale.screens'); var devices = require('point_of_sale.devices'); - var models = require('point_of_sale.models'); - var core = require('web.core'); - var _t = core._t; - var QWeb = core.qweb; - - models.load_fields('account.journal', ['payment_mode']); devices.ProxyDevice.include({ + init: function(parents, options) { var self = this; self._super(parents, options); @@ -73,43 +67,4 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { }, }); - - screens.PaymentScreenWidget.include({ - render_paymentlines : function(){ - this._super.apply(this, arguments); - var self = this; - this.$('.paymentlines-container').unbind('click').on('click', '.payment-terminal-transaction-start', function(event){ - // Why this "on" thing links severaltime the button to the action if I don't use "unlink" to reset the button links before ? - //console.log(event.target); - self.pos.get_order().in_transaction = true; - self.order_changes(); - self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name, self.pos.currency.decimals); - }); - }, - order_changes: function(){ - this._super.apply(this, arguments); - var order = this.pos.get_order(); - if (!order) { - return; - } else if (order.in_transaction) { - self.$('.next').html(''); - } else { - self.$('.next').html('Validate '); - } - } - }); - - var _orderproto = models.Order.prototype; - models.Order = models.Order.extend({ - initialize: function(){ - _orderproto.initialize.apply(this, arguments); - this.in_transaction = false; - }, - export_as_JSON: function() { - var vals = _orderproto.export_as_JSON.apply(this, arguments); - vals['transactions'] = this.transactions || {}; - return vals; - } - }); - }); diff --git a/pos_payment_terminal/static/src/js/models.js b/pos_payment_terminal/static/src/js/models.js new file mode 100644 index 00000000..cfb4035c --- /dev/null +++ b/pos_payment_terminal/static/src/js/models.js @@ -0,0 +1,30 @@ +/* + POS Payment Terminal module for Odoo + Copyright (C) 2014-2016 Aurélien DUMAINE + Copyright (C) 2014-2016 Akretion (www.akretion.com) + @author: Aurélien DUMAINE + @author: Alexis de Lattre + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +*/ + +odoo.define('pos_payment_terminal.models', function (require) { + "use strict"; + + var models = require('point_of_sale.models'); + var _orderproto = models.Order.prototype; + + models.load_fields('account.journal', ['payment_mode']); + + models.Order = models.Order.extend({ + initialize: function(){ + _orderproto.initialize.apply(this, arguments); + this.in_transaction = false; + }, + export_as_JSON: function() { + var vals = _orderproto.export_as_JSON.apply(this, arguments); + vals['transactions'] = this.transactions || {}; + return vals; + } + }); + +}); diff --git a/pos_payment_terminal/static/src/js/screens.js b/pos_payment_terminal/static/src/js/screens.js new file mode 100644 index 00000000..eddbd4d7 --- /dev/null +++ b/pos_payment_terminal/static/src/js/screens.js @@ -0,0 +1,42 @@ +/* + POS Payment Terminal module for Odoo + Copyright (C) 2014-2016 Aurélien DUMAINE + Copyright (C) 2014-2016 Akretion (www.akretion.com) + @author: Aurélien DUMAINE + @author: Alexis de Lattre + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +*/ + +odoo.define('pos_payment_terminal.screens', function (require) { + "use strict"; + + var screens = require('point_of_sale.screens'); + + screens.PaymentScreenWidget.include({ + + render_paymentlines : function(){ + this._super.apply(this, arguments); + var self = this; + this.$('.paymentlines-container').unbind('click').on('click', '.payment-terminal-transaction-start', function(event){ + // Why this "on" thing links severaltime the button to the action + // if I don't use "unlink" to reset the button links before ? + self.pos.get_order().in_transaction = true; + self.order_changes(); + self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name, self.pos.currency.decimals); + }); + }, + + order_changes: function(){ + this._super.apply(this, arguments); + var order = this.pos.get_order(); + if (!order) { + return; + } else if (order.in_transaction) { + self.$('.next').html(''); + } else { + self.$('.next').html('Validate '); + } + } + }); + +}); diff --git a/pos_payment_terminal/views/account_journal.xml b/pos_payment_terminal/views/account_journal.xml index 0e62aa9f..6c38cb33 100644 --- a/pos_payment_terminal/views/account_journal.xml +++ b/pos_payment_terminal/views/account_journal.xml @@ -1,14 +1,15 @@ - - pos.payment.terminal.journal.form + account.journal - - - + + + + + diff --git a/pos_payment_terminal/views/assets.xml b/pos_payment_terminal/views/assets.xml new file mode 100644 index 00000000..e3759f4f --- /dev/null +++ b/pos_payment_terminal/views/assets.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/pos_payment_terminal/views/pos_config.xml b/pos_payment_terminal/views/pos_config.xml index 6339b396..e6f68899 100644 --- a/pos_payment_terminal/views/pos_config.xml +++ b/pos_payment_terminal/views/pos_config.xml @@ -1,14 +1,17 @@ + - pos.payment.terminal.config.form pos.config - + - - - + +
+
+
diff --git a/pos_payment_terminal/views/pos_payment_terminal_template.xml b/pos_payment_terminal/views/pos_payment_terminal_template.xml deleted file mode 100644 index 0b619aff..00000000 --- a/pos_payment_terminal/views/pos_payment_terminal_template.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - -