Browse Source

Port pos_payment_terminal to v10

pull/124/head
Alexis de Lattre 8 years ago
parent
commit
c10036886b
  1. 31
      pos_payment_terminal/README.rst
  2. 4
      pos_payment_terminal/__init__.py
  3. 33
      pos_payment_terminal/__manifest__.py
  4. 0
      pos_payment_terminal/demo/pos_payment_terminal_demo.xml
  5. 4
      pos_payment_terminal/models/__init__.py
  6. 15
      pos_payment_terminal/models/account_journal.py
  7. 15
      pos_payment_terminal/models/pos_config.py
  8. 39
      pos_payment_terminal/pos_payment_terminal.py
  9. 28
      pos_payment_terminal/pos_payment_terminal_view.xml
  10. 25
      pos_payment_terminal/static/src/js/pos_payment_terminal.js
  11. 13
      pos_payment_terminal/static/src/xml/templates.xml
  12. 15
      pos_payment_terminal/views/account_journal.xml
  13. 15
      pos_payment_terminal/views/pos_config.xml
  14. 11
      pos_payment_terminal/views/pos_payment_terminal_template.xml

31
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 <https://github.com/odoo/odoo/pull/7367>` 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
<https://github.com/OCA/pos/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.

4
pos_payment_terminal/__init__.py

@ -1 +1,3 @@
from . import pos_payment_terminal
# -*- coding: utf-8 -*-
from . import models

33
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 <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',
'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,
}

0
pos_payment_terminal/pos_payment_terminal_demo.xml → pos_payment_terminal/demo/pos_payment_terminal_demo.xml

4
pos_payment_terminal/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import pos_config
from . import account_journal

15
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 <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")

15
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 <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")

39
pos_payment_terminal/pos_payment_terminal.py

@ -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")

28
pos_payment_terminal/pos_payment_terminal_view.xml

@ -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="amount_authorized_diff" position="after">
<field name="payment_mode"/>
</field>
</field>
</record>
</data>
</openerp>

25
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 <alexis.delattre@akretion.com>
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);
});
},
});
});

13
pos_payment_terminal/static/src/xml/templates.xml

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets" inherit_id="point_of_sale.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>
</data>
</openerp>

15
pos_payment_terminal/views/account_journal.xml

@ -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>

15
pos_payment_terminal/views/pos_config.xml

@ -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>

11
pos_payment_terminal/views/pos_payment_terminal_template.xml

@ -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>
Loading…
Cancel
Save