Browse Source
Merge pull request #124 from akretion/10-port-payment_terminal
Merge pull request #124 from akretion/10-port-payment_terminal
10.0 Port pos_payment terminalpull/129/merge
Pedro M. Baeza
8 years ago
committed by
GitHub
16 changed files with 153 additions and 153 deletions
-
31pos_payment_terminal/README.rst
-
4pos_payment_terminal/__init__.py
-
35pos_payment_terminal/__manifest__.py
-
10pos_payment_terminal/demo/pos_payment_terminal_demo.xml
-
4pos_payment_terminal/models/__init__.py
-
15pos_payment_terminal/models/account_journal.py
-
15pos_payment_terminal/models/pos_config.py
-
39pos_payment_terminal/pos_payment_terminal.py
-
18pos_payment_terminal/pos_payment_terminal.xml
-
28pos_payment_terminal/pos_payment_terminal_view.xml
-
2pos_payment_terminal/static/src/css/pos_payment_terminal.css
-
52pos_payment_terminal/static/src/js/pos_payment_terminal.js
-
10pos_payment_terminal/static/src/xml/pos_payment_terminal.xml
-
15pos_payment_terminal/views/account_journal.xml
-
15pos_payment_terminal/views/pos_config.xml
-
11pos_payment_terminal/views/pos_payment_terminal_template.xml
@ -1 +1,3 @@ |
|||||
from . import pos_payment_terminal |
|
||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import models |
@ -1,39 +1,22 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- 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 <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
|
||||
|
# © 2014-2016 Aurélien DUMAINE |
||||
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
{ |
{ |
||||
'name': 'POS Payment Terminal', |
'name': 'POS Payment Terminal', |
||||
'version': '8.0.0.1.0', |
|
||||
|
'version': '10.0.0.1.0', |
||||
'category': 'Point Of Sale', |
'category': 'Point Of Sale', |
||||
'summary': 'Manage Payment Terminal device from POS front end', |
'summary': 'Manage Payment Terminal device from POS front end', |
||||
'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", |
'author': "Aurélien DUMAINE,Akretion,Odoo Community Association (OCA)", |
||||
'license': 'AGPL-3', |
'license': 'AGPL-3', |
||||
'depends': ['point_of_sale'], |
'depends': ['point_of_sale'], |
||||
'data': [ |
'data': [ |
||||
'pos_payment_terminal.xml', |
|
||||
'pos_payment_terminal_view.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'], |
'qweb': ['static/src/xml/pos_payment_terminal.xml'], |
||||
'installable': False, |
|
||||
|
'installable': True, |
||||
} |
} |
@ -1,14 +1,8 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<openerp> |
|
||||
<data noupdate="1"> |
|
||||
|
|
||||
<record id="account.check_journal" model="account.journal"> |
|
||||
<field name="payment_mode">check</field> |
|
||||
</record> |
|
||||
|
<odoo noupdate="1"> |
||||
|
|
||||
<record id="point_of_sale.pos_config_main" model="pos.config"> |
<record id="point_of_sale.pos_config_main" model="pos.config"> |
||||
<field name="iface_payment_terminal" eval="True"/> |
<field name="iface_payment_terminal" eval="True"/> |
||||
</record> |
</record> |
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
</odoo> |
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import pos_config |
||||
|
from . import account_journal |
@ -0,0 +1,15 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2014-2016 Aurélien DUMAINE |
||||
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
||||
|
# 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") |
@ -0,0 +1,15 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2014-2016 Aurélien DUMAINE |
||||
|
# © 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
||||
|
# 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") |
@ -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 <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
|
||||
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") |
|
@ -1,18 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
|
|
||||
<template id="assets_backend" name="point_of_sale assets" inherit_id="web.assets_backend"> |
|
||||
<xpath expr="." position="inside"> |
|
||||
<script type="text/javascript" src="/pos_payment_terminal/static/src/js/pos_payment_terminal.js"></script> |
|
||||
</xpath> |
|
||||
</template> |
|
||||
|
|
||||
<template id="index" name="pos_payment_terminal index" inherit_id="point_of_sale.index"> |
|
||||
<xpath expr="//link[@id='pos-stylesheet']" position="after"> |
|
||||
<link rel="stylesheet" href="/pos_payment_terminal/static/src/css/pos_payment_terminal.css" id="pos_payment_terminal-stylesheet"/> |
|
||||
</xpath> |
|
||||
</template> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
@ -1,28 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
|
|
||||
<record id="view_pos_config_form" model="ir.ui.view"> |
|
||||
<field name="name">pos.payment.terminal.config.form</field> |
|
||||
<field name="model">pos.config</field> |
|
||||
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="iface_cashdrawer" position="after"> |
|
||||
<field name="iface_payment_terminal"/> |
|
||||
</field> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="view_account_journal_pos_user_form" model="ir.ui.view"> |
|
||||
<field name="name">pos.payment.terminal.journal.form</field> |
|
||||
<field name="model">account.journal</field> |
|
||||
<field name="inherit_id" ref="point_of_sale.view_account_journal_pos_user_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="self_checkout_payment_method" position="after"> |
|
||||
<field name="payment_mode"/> |
|
||||
</field> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
@ -1,34 +1,52 @@ |
|||||
/* |
/* |
||||
POS Payment Terminal module for Odoo |
POS Payment Terminal module for Odoo |
||||
Copyright (C) 2014 Aurélien DUMAINE |
|
||||
Copyright (C) 2014-2015 Akretion (www.akretion.com) |
|
||||
|
Copyright (C) 2014-2016 Aurélien DUMAINE |
||||
|
Copyright (C) 2014-2016 Akretion (www.akretion.com) |
||||
@author: Aurélien DUMAINE |
@author: Aurélien DUMAINE |
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com> |
@author: Alexis de Lattre <alexis.delattre@akretion.com> |
||||
The licence is in the file __openerp__.py |
|
||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
*/ |
*/ |
||||
|
|
||||
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 core = require('web.core'); |
||||
|
var _t = core._t; |
||||
|
var QWeb = core.qweb; |
||||
|
|
||||
|
models.load_fields('account.journal', ['payment_mode']); |
||||
|
|
||||
|
devices.ProxyDevice.include({ |
||||
|
payment_terminal_transaction_start: function(line_cid, currency_iso){ |
||||
|
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]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
module.ProxyDevice = module.ProxyDevice.extend({ |
|
||||
payment_terminal_transaction_start: function(line, currency_iso){ |
|
||||
var data = {'amount' : line.get_amount(), |
var data = {'amount' : line.get_amount(), |
||||
'currency_iso' : currency_iso, |
'currency_iso' : currency_iso, |
||||
'payment_mode' : line.cashregister.journal.payment_mode}; |
'payment_mode' : line.cashregister.journal.payment_mode}; |
||||
|
//console.log(JSON.stringify(data));
|
||||
this.message('payment_terminal_transaction_start', {'payment_info' : 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); |
|
||||
|
|
||||
|
screens.PaymentScreenWidget.include({ |
||||
|
render_paymentlines : function(){ |
||||
|
this._super.apply(this, arguments); |
||||
var self = this; |
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; |
|
||||
|
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); |
||||
|
}); |
||||
}, |
}, |
||||
}); |
}); |
||||
|
|
||||
}; |
|
||||
|
}); |
@ -1,11 +1,9 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<templates id="template" xml:space="preserve"> |
<templates id="template" xml:space="preserve"> |
||||
<t t-extend="Paymentline" > |
|
||||
<t t-jquery=".paymentline-input" t-operation="append"> |
|
||||
<t t-if="line.cashregister.journal.payment_mode"> |
|
||||
<span class="payment-terminal-transaction-start"> |
|
||||
<button>Start transaction</button> |
|
||||
</span> |
|
||||
|
<t t-extend="PaymentScreen-Paymentlines" > |
||||
|
<t t-jquery=".col-name" t-operation="append"> |
||||
|
<t t-if="line.cashregister.journal.payment_mode and widget.pos.config.iface_payment_terminal"> |
||||
|
<button class="payment-terminal-transaction-start" t-att-data-cid='line.cid'>Start transaction</button> |
||||
</t> |
</t> |
||||
</t> |
</t> |
||||
</t> |
</t> |
||||
|
@ -0,0 +1,15 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_account_journal_pos_user_form" model="ir.ui.view"> |
||||
|
<field name="name">pos.payment.terminal.journal.form</field> |
||||
|
<field name="model">account.journal</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.view_account_journal_pos_user_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="amount_authorized_diff" position="after"> |
||||
|
<field name="payment_mode"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,15 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_pos_config_form" model="ir.ui.view"> |
||||
|
<field name="name">pos.payment.terminal.config.form</field> |
||||
|
<field name="model">pos.config</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="iface_cashdrawer" position="after"> |
||||
|
<field name="iface_payment_terminal"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,11 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
|
||||
|
<template id="assets" inherit_id="point_of_sale.assets_backend" name="pos_payment_terminal assets"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/pos_payment_terminal/static/src/js/pos_payment_terminal.js"></script> |
||||
|
<link rel="stylesheet" href="/pos_payment_terminal/static/src/css/pos_payment_terminal.css" /> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue