diff --git a/pos_payment_terminal/__openerp__.py b/pos_payment_terminal/__openerp__.py
index 6538c81d..acfd1668 100644
--- a/pos_payment_terminal/__openerp__.py
+++ b/pos_payment_terminal/__openerp__.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 @@
-
-
+
+
+
-
-
-
+