Browse Source

Remove currency_iso_numeric (replaced by pycountry)

Adapt JS code of pos_payment_terminal
Some cleanup
pull/440/head
Alexis de Lattre 10 years ago
committed by Sylvain LE GAL
parent
commit
0996c84a28
  1. 2
      pos_payment_terminal/__openerp__.py
  2. 4
      pos_payment_terminal/pos_payment_terminal.py
  3. 45
      pos_payment_terminal/static/src/js/pos_payment_terminal.js

2
pos_payment_terminal/__openerp__.py

@ -36,7 +36,7 @@ This module support two payment methods : cards and checks. The payment method s
This module has been developped during a POS code sprint at Akretion France from July 7th to July 10th 2014. This module is part of the POS project of the Odoo Community Association http://odoo-community.org/. You are invited to become a member and/or get involved in the Association !
""",
'author': 'Aurélien DUMAINE',
'depends': ['point_of_sale', 'currency_iso_numeric'],
'depends': ['point_of_sale'],
'data': [
'pos_payment_terminal.xml',
'pos_payment_terminal_view.xml',

4
pos_payment_terminal/pos_payment_terminal.py

@ -23,7 +23,6 @@ from openerp import models, fields
class account_journal(models.Model):
_name = 'account.journal'
_inherit = 'account.journal'
payment_mode = fields.Selection(
@ -32,11 +31,8 @@ class account_journal(models.Model):
class pos_config(models.Model):
_name = 'pos.config'
_inherit = 'pos.config'
iface_payment_terminal = fields.Boolean(
'Payment Terminal',
help="A payment terminal is available on the Proxy")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

45
pos_payment_terminal/static/src/js/pos_payment_terminal.js

@ -2,10 +2,9 @@ openerp.pos_payment_terminal = function(instance){
module = instance.point_of_sale;
module.ProxyDevice = module.ProxyDevice.extend({
payment_terminal_transaction_start: function(line, currency_iso, currency_iso_numeric){
payment_terminal_transaction_start: function(line, currency_iso){
var data = {'amount' : line.get_amount(),
'currency_iso' : currency_iso,
'currency_iso_numeric' : currency_iso_numeric,
'payment_mode' : line.cashregister.journal.payment_mode};
// alert(JSON.stringify(data));
this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)});
@ -20,12 +19,11 @@ openerp.pos_payment_terminal = function(instance){
self = this;
this.payment_terminal_transaction_start = function(event){
var node = this;
while(node && !node.classList.contains('paymentline')){
while (node && !node.classList.contains('paymentline')){
node = node.parentNode;
}
if(node){
if (self.pos.config.iface_payment_terminal)
self.pos.proxy.payment_terminal_transaction_start(node.line, self.pos.currency.name, self.pos.currency.iso_numeric);
if (node && !_.isEmpty(node.line) && self.pos.config.iface_payment_terminal){
self.pos.proxy.payment_terminal_transaction_start(node.line, self.pos.currency.name);
}
event.stopPropagation();
};
@ -37,11 +35,10 @@ openerp.pos_payment_terminal = function(instance){
if (line.cashregister.journal.payment_mode && this.pos.config.iface_payment_terminal){
if (!this.pos.currency.name){
var self = this;
var currencies = new instance.web.Model('res.currency').query(['name', 'iso_numeric'])
var currencies = new instance.web.Model('res.currency').query(['name'])
.filter([['id','=',this.pos.currency.id]])
.all().then(function (currency) {
self.pos.currency.name = currency[0].name;
self.pos.currency.iso_numeric = currency[0].iso_numeric;
});
}
el_node.querySelector('.payment-terminal-transaction-start')
@ -50,36 +47,4 @@ openerp.pos_payment_terminal = function(instance){
return el_node;
};
/*
var _super_load_server_data_ = module.PosModel.prototype.load_server_data;
module.PosModel.prototype.load_server_data = function(){
var loaded = _super_load_server_data_.call(this);
//FIXME : this is asynchronous, I can't assume the pos.currency loaded when we enter is this
this.pos.currency.name = new instance.web.Model('res.currency').query('name').filter([['id','=',this.pos_currency.id]]).all()[0]
return loaded;
};
*/
/*
var _super_setSmartStatus_ = module.ProxyStatusWidget.prototype.set_smart_status;
module.ProxyStatusWidget.prototype.set_smart_status = function(status){
_super_setSmartStatus_.call(this, status);
if(status.status === 'connected'){
var warning = false;
var msg = ''
if(this.pos.config.iface_customer_display){
var customer_display = status.drivers.customer_display ? status.drivers.customer_display.status : false;
if( customer_display != 'connected' && customer_display != 'connecting'){
warning = true;
msg = msg ? msg + ' & ' : msg;
msg += _t('Customer display');
}
}
msg = msg ? msg + ' ' + _t('Offline') : msg;
this.set_status(warning ? 'warning' : 'connected', msg);
}else{
this.set_status(status.status,'');
}
};
*/
};
Loading…
Cancel
Save