From 81aebd36ba1ab9d68eed77d83fbf35d5b7d78ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20DUMAINE?= Date: Tue, 17 May 2016 03:35:29 +0200 Subject: [PATCH 1/6] begin of porting pos_payment_terminal to Odoo 9.0 --- pos_payment_terminal/__manifest__.py | 6 +- pos_payment_terminal/pos_payment_terminal.xml | 18 ---- .../pos_payment_terminal_view.xml | 2 +- .../static/src/js/pos_payment_terminal.js | 96 +++++++++++++++---- .../static/src/xml/pos_payment_terminal.xml | 13 ++- 5 files changed, 91 insertions(+), 44 deletions(-) delete mode 100644 pos_payment_terminal/pos_payment_terminal.xml diff --git a/pos_payment_terminal/__manifest__.py b/pos_payment_terminal/__manifest__.py index 6538c81d..acfd1668 100644 --- a/pos_payment_terminal/__manifest__.py +++ b/pos_payment_terminal/__manifest__.py @@ -23,17 +23,17 @@ { 'name': 'POS Payment Terminal', - 'version': '8.0.0.1.0', + 'version': '9.0.0.1.0', 'category': 'Point Of Sale', 'summary': 'Manage Payment Terminal device from POS front end', 'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ - 'pos_payment_terminal.xml', 'pos_payment_terminal_view.xml', + 'static/src/xml/templates.xml', ], 'demo': ['pos_payment_terminal_demo.xml'], 'qweb': ['static/src/xml/pos_payment_terminal.xml'], - 'installable': False, + 'installable': True, } diff --git a/pos_payment_terminal/pos_payment_terminal.xml b/pos_payment_terminal/pos_payment_terminal.xml deleted file mode 100644 index 6f46ad01..00000000 --- a/pos_payment_terminal/pos_payment_terminal.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/pos_payment_terminal/pos_payment_terminal_view.xml b/pos_payment_terminal/pos_payment_terminal_view.xml index 8a72bd1a..509ee3dc 100644 --- a/pos_payment_terminal/pos_payment_terminal_view.xml +++ b/pos_payment_terminal/pos_payment_terminal_view.xml @@ -18,7 +18,7 @@ account.journal - + diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/pos_payment_terminal.js index 39ae910f..82bdc8b4 100755 --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/pos_payment_terminal.js @@ -1,34 +1,96 @@ /* POS Payment Terminal module for Odoo - Copyright (C) 2014 Aurélien DUMAINE + Copyright (C) 2014-2016 Aurélien DUMAINE Copyright (C) 2014-2015 Akretion (www.akretion.com) @author: Aurélien DUMAINE @author: Alexis de Lattre The licence is in the file __openerp__.py */ -openerp.pos_payment_terminal = function(instance){ - module = instance.point_of_sale; +odoo.define('pos_payment_terminal.pos_payment_terminal', 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 gui = require('point_of_sale.gui'); + var core = require('web.core'); + var _t = core._t; + var QWeb = core.qweb; + +/* + //TODO : surcharger models.exports.PosModel.load_server_data pour récupérer le champ 'payement_mode' des journaux + var _r_ = models.exports.PosModel.prototype.load_server_data; + models.exports.PosModel.prototype.load_server_data = function(){ + var self = this; + for (var i = 0; i < self.models.length; i++){ + if (self.models[i].model== 'account.journal'){ + self.models[i].fields.push('payment_mode'); + } + } + _r_.call(this); + }); +*/ + devices.ProxyDevice.include({ + payment_terminal_transaction_start: function(line_cid, currency_iso){ + var lines = this.pos.get_order().get_paymentlines(); + var line; + for ( var i = 0; i < lines.length; i++ ) { + if (lines[i].cid === line_cid) { + line = lines[i]; + } + } - module.ProxyDevice = module.ProxyDevice.extend({ - payment_terminal_transaction_start: function(line, currency_iso){ var data = {'amount' : line.get_amount(), 'currency_iso' : currency_iso, 'payment_mode' : line.cashregister.journal.payment_mode}; +alert(JSON.stringify(data)); this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)}); }, }); - module.PaymentScreenWidget.include({ - render_paymentline: function(line){ - el_node = this._super(line); - var self = this; - if (line.cashregister.journal.payment_mode && this.pos.config.iface_payment_terminal){ - el_node.querySelector('.payment-terminal-transaction-start') - .addEventListener('click', function(){self.pos.proxy.payment_terminal_transaction_start(line, self.pos.currency.name)}); - } - return el_node; - }, - }); -}; +// TODO : overload instead of redefine +// var _render_paymentlines_ = screens.PaymentScreenWidget.prototype.render_paymentlines; + screens.PaymentScreenWidget.prototype.render_paymentlines = function(){ +// _render_paymentlines_.call(this); + var self = this; + var order = this.pos.get_order(); + if (!order) { + return; + } + + var lines = order.get_paymentlines(); + var due = order.get_due(); + var extradue = 0; + if (due && lines.length && due !== order.get_due(lines[lines.length-1])) { + extradue = due; + } + + + this.$('.paymentlines-container').empty(); + var lines = $(QWeb.render('PaymentScreen-Paymentlines', { + widget: this, + order: order, + paymentlines: lines, + extradue: extradue, + })); + + lines.on('click','.delete-button',function(){ + self.click_delete_paymentline($(this).data('cid')); + }); + + lines.on('click','.paymentline',function(){ + self.click_paymentline($(this).data('cid')); + }); + + lines.on('click','.payment-terminal-transaction-start',function(){ + self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); + }); + + + lines.appendTo(this.$('.paymentlines-container')); + //if (line.cashregister.journal.payment_mode && this.pos.config.iface_payment_terminal){ + + }; +}); diff --git a/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml b/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml index 48ff65a6..2d5aa824 100644 --- a/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml +++ b/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml @@ -1,11 +1,14 @@ - - + + + - - - + From 93faa9f2d1c0116cc2b5dd92322ad5f08f0d8b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20DUMAINE?= Date: Tue, 17 May 2016 05:31:45 +0200 Subject: [PATCH 2/6] overload render_paymentlines --- .../static/src/js/pos_payment_terminal.js | 38 +++++++++---------- .../static/src/xml/pos_payment_terminal.xml | 7 +--- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/pos_payment_terminal.js index 82bdc8b4..ff81aa82 100755 --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/pos_payment_terminal.js @@ -18,23 +18,12 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { var _t = core._t; var QWeb = core.qweb; -/* - //TODO : surcharger models.exports.PosModel.load_server_data pour récupérer le champ 'payement_mode' des journaux - var _r_ = models.exports.PosModel.prototype.load_server_data; - models.exports.PosModel.prototype.load_server_data = function(){ - var self = this; - for (var i = 0; i < self.models.length; i++){ - if (self.models[i].model== 'account.journal'){ - self.models[i].fields.push('payment_mode'); - } - } - _r_.call(this); - }); -*/ + models.load_fields("account.journal",['payment_mode']); + devices.ProxyDevice.include({ payment_terminal_transaction_start: function(line_cid, currency_iso){ - var lines = this.pos.get_order().get_paymentlines(); var line; + var lines = this.pos.get_order().get_paymentlines(); for ( var i = 0; i < lines.length; i++ ) { if (lines[i].cid === line_cid) { line = lines[i]; @@ -44,16 +33,23 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { var data = {'amount' : line.get_amount(), 'currency_iso' : currency_iso, 'payment_mode' : line.cashregister.journal.payment_mode}; -alert(JSON.stringify(data)); +//alert(JSON.stringify(data)); this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)}); }, }); // TODO : overload instead of redefine -// var _render_paymentlines_ = screens.PaymentScreenWidget.prototype.render_paymentlines; - screens.PaymentScreenWidget.prototype.render_paymentlines = function(){ -// _render_paymentlines_.call(this); +// BUG : its works fine when redefine but calls 5 times the function is overload + screens.PaymentScreenWidget.include({ + render_paymentlines : function(){ + this._super.apply(this, arguments); + var self = this; + this.$('.paymentlines-container').on('click','.payment-terminal-transaction-start',function(){ + self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); + }); + +/* var self = this; var order = this.pos.get_order(); if (!order) { @@ -88,9 +84,9 @@ alert(JSON.stringify(data)); self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); }); - lines.appendTo(this.$('.paymentlines-container')); - //if (line.cashregister.journal.payment_mode && this.pos.config.iface_payment_terminal){ +*/ + }, - }; + }); }); diff --git a/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml b/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml index 2d5aa824..b0b197bd 100644 --- a/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml +++ b/pos_payment_terminal/static/src/xml/pos_payment_terminal.xml @@ -2,12 +2,7 @@ - - + From 587f8f77c4c3d2a21e9709bb3d07c7ccbe924bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20DUMAINE?= Date: Sat, 21 May 2016 17:19:34 +0200 Subject: [PATCH 3/6] FIX : multiple calls to action on 'start transaction' click event --- .../static/src/css/pos_payment_terminal.css | 2 +- .../static/src/js/pos_payment_terminal.js | 59 ++++--------------- 2 files changed, 12 insertions(+), 49 deletions(-) diff --git a/pos_payment_terminal/static/src/css/pos_payment_terminal.css b/pos_payment_terminal/static/src/css/pos_payment_terminal.css index bfec68ef..d3f4284c 100644 --- a/pos_payment_terminal/static/src/css/pos_payment_terminal.css +++ b/pos_payment_terminal/static/src/css/pos_payment_terminal.css @@ -1,4 +1,4 @@ -.pos .payment-terminal-transaction-start button { +.payment-terminal-transaction-start button { width: 150px; height: 60px; font-size: 18px; diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/pos_payment_terminal.js index ff81aa82..7cae07fb 100755 --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/pos_payment_terminal.js @@ -33,60 +33,23 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { var data = {'amount' : line.get_amount(), 'currency_iso' : currency_iso, 'payment_mode' : line.cashregister.journal.payment_mode}; -//alert(JSON.stringify(data)); + //console.log(JSON.stringify(data)); this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)}); }, }); -// TODO : overload instead of redefine -// BUG : its works fine when redefine but calls 5 times the function is overload screens.PaymentScreenWidget.include({ - render_paymentlines : function(){ - this._super.apply(this, arguments); - var self = this; - this.$('.paymentlines-container').on('click','.payment-terminal-transaction-start',function(){ - self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); - }); - -/* - var self = this; - var order = this.pos.get_order(); - if (!order) { - return; - } - - var lines = order.get_paymentlines(); - var due = order.get_due(); - var extradue = 0; - if (due && lines.length && due !== order.get_due(lines[lines.length-1])) { - extradue = due; - } - - - this.$('.paymentlines-container').empty(); - var lines = $(QWeb.render('PaymentScreen-Paymentlines', { - widget: this, - order: order, - paymentlines: lines, - extradue: extradue, - })); - - lines.on('click','.delete-button',function(){ - self.click_delete_paymentline($(this).data('cid')); - }); - - lines.on('click','.paymentline',function(){ - self.click_paymentline($(this).data('cid')); - }); - - lines.on('click','.payment-terminal-transaction-start',function(){ - self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); - }); - - lines.appendTo(this.$('.paymentlines-container')); -*/ - }, + 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.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); + }); + + }, }); }); From bd20bdaa58424d93f822d209cb14c25ed3c3cf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20DUMAINE?= Date: Sun, 10 Jul 2016 21:08:52 +0200 Subject: [PATCH 4/6] Add static/src/xml/templates.xml --- pos_payment_terminal/static/src/xml/templates.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pos_payment_terminal/static/src/xml/templates.xml diff --git a/pos_payment_terminal/static/src/xml/templates.xml b/pos_payment_terminal/static/src/xml/templates.xml new file mode 100644 index 00000000..01939637 --- /dev/null +++ b/pos_payment_terminal/static/src/xml/templates.xml @@ -0,0 +1,13 @@ + + + + + + + + From c36b0ae8d1702af93477049308fe1c2ae6cf355f Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 10 Oct 2016 21:14:04 +0200 Subject: [PATCH 5/6] FIX crash on demo data --- pos_payment_terminal/pos_payment_terminal_demo.xml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pos_payment_terminal/pos_payment_terminal_demo.xml b/pos_payment_terminal/pos_payment_terminal_demo.xml index 1788dae4..fb3dbd39 100644 --- a/pos_payment_terminal/pos_payment_terminal_demo.xml +++ b/pos_payment_terminal/pos_payment_terminal_demo.xml @@ -1,14 +1,8 @@ - - - - - check - + - - + From c10036886b489273186672ea09f0f977241776b2 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 10 Oct 2016 22:50:58 +0200 Subject: [PATCH 6/6] Port pos_payment_terminal to v10 --- pos_payment_terminal/README.rst | 31 +++++++++++---- pos_payment_terminal/__init__.py | 4 +- pos_payment_terminal/__manifest__.py | 33 ++++------------ .../{ => demo}/pos_payment_terminal_demo.xml | 0 pos_payment_terminal/models/__init__.py | 4 ++ .../models/account_journal.py | 15 +++++++ pos_payment_terminal/models/pos_config.py | 15 +++++++ pos_payment_terminal/pos_payment_terminal.py | 39 ------------------- .../pos_payment_terminal_view.xml | 28 ------------- .../static/src/js/pos_payment_terminal.js | 25 ++++++------ .../static/src/xml/templates.xml | 13 ------- .../views/account_journal.xml | 15 +++++++ pos_payment_terminal/views/pos_config.xml | 15 +++++++ .../views/pos_payment_terminal_template.xml | 11 ++++++ 14 files changed, 120 insertions(+), 128 deletions(-) rename pos_payment_terminal/{ => demo}/pos_payment_terminal_demo.xml (100%) create mode 100644 pos_payment_terminal/models/__init__.py create mode 100644 pos_payment_terminal/models/account_journal.py create mode 100644 pos_payment_terminal/models/pos_config.py delete mode 100644 pos_payment_terminal/pos_payment_terminal.py delete mode 100644 pos_payment_terminal/pos_payment_terminal_view.xml delete mode 100644 pos_payment_terminal/static/src/xml/templates.xml create mode 100644 pos_payment_terminal/views/account_journal.xml create mode 100644 pos_payment_terminal/views/pos_config.xml create mode 100644 pos_payment_terminal/views/pos_payment_terminal_template.xml diff --git a/pos_payment_terminal/README.rst b/pos_payment_terminal/README.rst index 6c1c22da..b8139ea0 100644 --- a/pos_payment_terminal/README.rst +++ b/pos_payment_terminal/README.rst @@ -1,3 +1,8 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +==================== POS Payment Terminal ==================== @@ -20,10 +25,6 @@ This module is designed to be installed on the and old Sagem devices support the Telium protocol implemented in the *hw_telium_payment_terminal* module. -This module requires an up-to-date version of Odoo v8 that includes -`this pull request ` which was -merged in the *8.0* branch of Odoo on Github on July 2nd 2015. - Configuration ============= @@ -36,6 +37,18 @@ Usage In the frontend of the POS, when you select a payment method that has a payment mode *card* or *check*, you will have a *Start Transaction* button : if you click on that button, the amount, the currency and the payment mode will be sent to the POSbox. +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/184/10.0 + +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. + Credits ======= @@ -48,12 +61,14 @@ Contributors Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. -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. +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. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/pos_payment_terminal/__init__.py b/pos_payment_terminal/__init__.py index 9e67b3d9..cde864ba 100644 --- a/pos_payment_terminal/__init__.py +++ b/pos_payment_terminal/__init__.py @@ -1 +1,3 @@ -from . import pos_payment_terminal +# -*- coding: utf-8 -*- + +from . import models diff --git a/pos_payment_terminal/__manifest__.py b/pos_payment_terminal/__manifest__.py index acfd1668..850a8e84 100644 --- a/pos_payment_terminal/__manifest__.py +++ b/pos_payment_terminal/__manifest__.py @@ -1,39 +1,22 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# POS Payment Terminal module for Odoo -# Copyright (C) 2014 Aurélien DUMAINE -# Copyright (C) 2015 Akretion (www.akretion.com) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - +# © 2014-2016 Aurélien DUMAINE +# © 2015-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'POS Payment Terminal', - 'version': '9.0.0.1.0', + 'version': '10.0.0.1.0', 'category': 'Point Of Sale', 'summary': 'Manage Payment Terminal device from POS front end', 'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'depends': ['point_of_sale'], 'data': [ - 'pos_payment_terminal_view.xml', - 'static/src/xml/templates.xml', + 'views/pos_config.xml', + 'views/account_journal.xml', + 'views/pos_payment_terminal_template.xml', ], - 'demo': ['pos_payment_terminal_demo.xml'], + 'demo': ['demo/pos_payment_terminal_demo.xml'], 'qweb': ['static/src/xml/pos_payment_terminal.xml'], 'installable': True, } diff --git a/pos_payment_terminal/pos_payment_terminal_demo.xml b/pos_payment_terminal/demo/pos_payment_terminal_demo.xml similarity index 100% rename from pos_payment_terminal/pos_payment_terminal_demo.xml rename to pos_payment_terminal/demo/pos_payment_terminal_demo.xml diff --git a/pos_payment_terminal/models/__init__.py b/pos_payment_terminal/models/__init__.py new file mode 100644 index 00000000..3b0e3a1a --- /dev/null +++ b/pos_payment_terminal/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import pos_config +from . import account_journal diff --git a/pos_payment_terminal/models/account_journal.py b/pos_payment_terminal/models/account_journal.py new file mode 100644 index 00000000..6f7c9678 --- /dev/null +++ b/pos_payment_terminal/models/account_journal.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# © 2014-2016 Aurélien DUMAINE +# © 2015-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import models, fields + + +class AccountJournal(models.Model): + _inherit = 'account.journal' + + payment_mode = fields.Selection( + [('card', 'Card'), ('check', 'Check')], 'Payment Mode', + help="Select the payment mode sent to the payment terminal") diff --git a/pos_payment_terminal/models/pos_config.py b/pos_payment_terminal/models/pos_config.py new file mode 100644 index 00000000..2d7da41a --- /dev/null +++ b/pos_payment_terminal/models/pos_config.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# © 2014-2016 Aurélien DUMAINE +# © 2015-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import models, fields + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + iface_payment_terminal = fields.Boolean( + 'Payment Terminal', + help="A payment terminal is available on the Proxy") diff --git a/pos_payment_terminal/pos_payment_terminal.py b/pos_payment_terminal/pos_payment_terminal.py deleted file mode 100644 index 1d2bd4ec..00000000 --- a/pos_payment_terminal/pos_payment_terminal.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# POS Payment Terminal module for Odoo -# Copyright (C) 2014 Aurélien DUMAINE -# Copyright (C) 2015 Akretion (www.akretion.com) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp import models, fields - - -class AccountJournal(models.Model): - _inherit = 'account.journal' - - payment_mode = fields.Selection( - (('card', 'Card'), ('check', 'Check')), 'Payment mode', - help="Select the payment mode sent to the payment terminal") - - -class PosConfig(models.Model): - _inherit = 'pos.config' - - iface_payment_terminal = fields.Boolean( - 'Payment Terminal', - help="A payment terminal is available on the Proxy") diff --git a/pos_payment_terminal/pos_payment_terminal_view.xml b/pos_payment_terminal/pos_payment_terminal_view.xml deleted file mode 100644 index 509ee3dc..00000000 --- a/pos_payment_terminal/pos_payment_terminal_view.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - pos.payment.terminal.config.form - pos.config - - - - - - - - - - pos.payment.terminal.journal.form - account.journal - - - - - - - - - - diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/pos_payment_terminal.js index 7cae07fb..984d09b3 100755 --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/pos_payment_terminal.js @@ -1,10 +1,10 @@ /* POS Payment Terminal module for Odoo Copyright (C) 2014-2016 Aurélien DUMAINE - Copyright (C) 2014-2015 Akretion (www.akretion.com) + Copyright (C) 2014-2016 Akretion (www.akretion.com) @author: Aurélien DUMAINE @author: Alexis de Lattre - The licence is in the file __openerp__.py + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { @@ -13,12 +13,11 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { var screens = require('point_of_sale.screens'); var devices = require('point_of_sale.devices'); var models = require('point_of_sale.models'); -// var gui = require('point_of_sale.gui'); var core = require('web.core'); var _t = core._t; var QWeb = core.qweb; - models.load_fields("account.journal",['payment_mode']); + models.load_fields('account.journal', ['payment_mode']); devices.ProxyDevice.include({ payment_terminal_transaction_start: function(line_cid, currency_iso){ @@ -40,16 +39,14 @@ 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){ + 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.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); - }); - - }, - + //console.log(event.target); + self.pos.proxy.payment_terminal_transaction_start($(this).data('cid'), self.pos.currency.name); + }); + }, }); }); diff --git a/pos_payment_terminal/static/src/xml/templates.xml b/pos_payment_terminal/static/src/xml/templates.xml deleted file mode 100644 index 01939637..00000000 --- a/pos_payment_terminal/static/src/xml/templates.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/pos_payment_terminal/views/account_journal.xml b/pos_payment_terminal/views/account_journal.xml new file mode 100644 index 00000000..0e62aa9f --- /dev/null +++ b/pos_payment_terminal/views/account_journal.xml @@ -0,0 +1,15 @@ + + + + + pos.payment.terminal.journal.form + account.journal + + + + + + + + + diff --git a/pos_payment_terminal/views/pos_config.xml b/pos_payment_terminal/views/pos_config.xml new file mode 100644 index 00000000..6339b396 --- /dev/null +++ b/pos_payment_terminal/views/pos_config.xml @@ -0,0 +1,15 @@ + + + + + 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 new file mode 100644 index 00000000..976acc2d --- /dev/null +++ b/pos_payment_terminal/views/pos_payment_terminal_template.xml @@ -0,0 +1,11 @@ + + + + + +