Browse Source

Remove currency_iso_numeric (replaced by pycountry)

Adapt JS code of pos_payment_terminal
Some cleanup
pull/10/head
Alexis de Lattre 10 years ago
parent
commit
7f37501f2f
  1. 24
      currency_iso_numeric/__init__.py
  2. 48
      currency_iso_numeric/__openerp__.py
  3. 27
      currency_iso_numeric/i18n/currency_iso_numeric.pot
  4. 27
      currency_iso_numeric/i18n/fr.po
  5. 30
      currency_iso_numeric/res_currency.py
  6. 615
      currency_iso_numeric/res_currency_data.xml
  7. 37
      currency_iso_numeric/res_currency_view.xml
  8. 1
      hw_customer_display/__openerp__.py
  9. 2
      pos_payment_terminal/__openerp__.py
  10. 4
      pos_payment_terminal/pos_payment_terminal.py
  11. 97
      pos_payment_terminal/static/src/js/pos_payment_terminal.js

24
currency_iso_numeric/__init__.py

@ -1,24 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Currency ISO Numeric module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@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 . import res_currency

48
currency_iso_numeric/__openerp__.py

@ -1,48 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Currency ISO Numeric module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@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/>.
#
##############################################################################
{
'name': 'Currency ISO Numeric',
'version': '0.1',
'category': 'Currency',
'license': 'AGPL-3',
'summary': 'Adds ISO 4217 numeric codes on currencies',
'description': """
Currency ISO Numeric
====================
This module adds a field *ISO Numeric Code* on currencies. This numeric ISO code is required by some applications ; for example, it is used in the Telium protocol for the communication between the Point of Sale and the credit card reader.
This module has been developped during a POS code sprint at Akretion France from July 7th to July 10th 2014.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['base'],
'data': [
'res_currency_data.xml',
'res_currency_view.xml',
],
'active': False,
}

27
currency_iso_numeric/i18n/currency_iso_numeric.pot

@ -1,27 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * currency_iso_numeric
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 8.0alpha1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-09 16:50+0000\n"
"PO-Revision-Date: 2014-07-09 16:50+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: currency_iso_numeric
#: model:ir.model,name:currency_iso_numeric.model_res_currency
msgid "Currency"
msgstr ""
#. module: currency_iso_numeric
#: field:res.currency,iso_numeric:0
msgid "ISO Numeric Code"
msgstr ""

27
currency_iso_numeric/i18n/fr.po

@ -1,27 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * currency_iso_numeric
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 8.0alpha1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-09 16:51+0000\n"
"PO-Revision-Date: 2014-07-09 16:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: currency_iso_numeric
#: model:ir.model,name:currency_iso_numeric.model_res_currency
msgid "Currency"
msgstr "Devise"
#. module: currency_iso_numeric
#: field:res.currency,iso_numeric:0
msgid "ISO Numeric Code"
msgstr "Code ISO numérique"

30
currency_iso_numeric/res_currency.py

@ -1,30 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Currency ISO Numeric module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@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 Currency(models.Model):
_inherit = 'res.currency'
iso_numeric = fields.Char(string='ISO Numeric Code', size=4)

615
currency_iso_numeric/res_currency_data.xml

@ -1,615 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data noupdate="0"> <!-- TODO chane to 1 -->
<record id="base.AFN" model="res.currency">
<field name="iso_numeric">971</field>
</record>
<record id="base.EUR" model="res.currency">
<field name="iso_numeric">978</field>
</record>
<record id="base.ALL" model="res.currency">
<field name="iso_numeric">008</field>
</record>
<record id="base.DZD" model="res.currency">
<field name="iso_numeric">012</field>
</record>
<record id="base.USD" model="res.currency">
<field name="iso_numeric">840</field>
</record>
<record id="base.AOA" model="res.currency">
<field name="iso_numeric">973</field>
</record>
<record id="base.XCD" model="res.currency">
<field name="iso_numeric">951</field>
</record>
<record id="base.ARS" model="res.currency">
<field name="iso_numeric">032</field>
</record>
<record id="base.AMD" model="res.currency">
<field name="iso_numeric">051</field>
</record>
<record id="base.AWG" model="res.currency">
<field name="iso_numeric">533</field>
</record>
<record id="base.AUD" model="res.currency">
<field name="iso_numeric">036</field>
</record>
<record id="base.AZN" model="res.currency">
<field name="iso_numeric">944</field>
</record>
<record id="base.BSD" model="res.currency">
<field name="iso_numeric">044</field>
</record>
<record id="base.BHD" model="res.currency">
<field name="iso_numeric">048</field>
</record>
<record id="base.BDT" model="res.currency">
<field name="iso_numeric">050</field>
</record>
<record id="base.BBD" model="res.currency">
<field name="iso_numeric">052</field>
</record>
<record id="base.BYR" model="res.currency">
<field name="iso_numeric">974</field>
</record>
<record id="base.BZD" model="res.currency">
<field name="iso_numeric">084</field>
</record>
<record id="base.XOF" model="res.currency">
<field name="iso_numeric">952</field>
</record>
<record id="base.BMD" model="res.currency">
<field name="iso_numeric">060</field>
</record>
<record id="base.BTN" model="res.currency">
<field name="iso_numeric">064</field>
</record>
<record id="base.INR" model="res.currency">
<field name="iso_numeric">356</field>
</record>
<record id="base.BOB" model="res.currency">
<field name="iso_numeric">068</field>
</record>
<record id="base.BAM" model="res.currency">
<field name="iso_numeric">977</field>
</record>
<record id="base.BWP" model="res.currency">
<field name="iso_numeric">072</field>
</record>
<record id="base.NOK" model="res.currency">
<field name="iso_numeric">578</field>
</record>
<record id="base.BRL" model="res.currency">
<field name="iso_numeric">986</field>
</record>
<record id="base.BND" model="res.currency">
<field name="iso_numeric">096</field>
</record>
<record id="base.BGN" model="res.currency">
<field name="iso_numeric">975</field>
</record>
<record id="base.BIF" model="res.currency">
<field name="iso_numeric">108</field>
</record>
<record id="base.KHR" model="res.currency">
<field name="iso_numeric">116</field>
</record>
<record id="base.XAF" model="res.currency">
<field name="iso_numeric">950</field>
</record>
<record id="base.CAD" model="res.currency">
<field name="iso_numeric">124</field>
</record>
<record id="base.CVE" model="res.currency">
<field name="iso_numeric">132</field>
</record>
<record id="base.KYD" model="res.currency">
<field name="iso_numeric">136</field>
</record>
<record id="base.CLP" model="res.currency">
<field name="iso_numeric">152</field>
</record>
<record id="base.CNY" model="res.currency">
<field name="iso_numeric">156</field>
</record>
<record id="base.COP" model="res.currency">
<field name="iso_numeric">170</field>
</record>
<record id="base.KMF" model="res.currency">
<field name="iso_numeric">174</field>
</record>
<record id="base.CDF" model="res.currency">
<field name="iso_numeric">976</field>
</record>
<record id="base.NZD" model="res.currency">
<field name="iso_numeric">554</field>
</record>
<record id="base.CRC" model="res.currency">
<field name="iso_numeric">188</field>
</record>
<record id="base.HRK" model="res.currency">
<field name="iso_numeric">191</field>
</record>
<record id="base.CUP" model="res.currency">
<field name="iso_numeric">192</field>
</record>
<record id="base.ANG" model="res.currency">
<field name="iso_numeric">532</field>
</record>
<record id="base.CZK" model="res.currency">
<field name="iso_numeric">203</field>
</record>
<record id="base.DKK" model="res.currency">
<field name="iso_numeric">208</field>
</record>
<record id="base.DJF" model="res.currency">
<field name="iso_numeric">262</field>
</record>
<record id="base.DOP" model="res.currency">
<field name="iso_numeric">214</field>
</record>
<record id="base.EGP" model="res.currency">
<field name="iso_numeric">818</field>
</record>
<record id="base.SVC" model="res.currency">
<field name="iso_numeric">222</field>
</record>
<record id="base.ERN" model="res.currency">
<field name="iso_numeric">232</field>
</record>
<record id="base.ETB" model="res.currency">
<field name="iso_numeric">230</field>
</record>
<record id="base.FKP" model="res.currency">
<field name="iso_numeric">238</field>
</record>
<record id="base.FJD" model="res.currency">
<field name="iso_numeric">242</field>
</record>
<record id="base.XPF" model="res.currency">
<field name="iso_numeric">953</field>
</record>
<record id="base.GMD" model="res.currency">
<field name="iso_numeric">270</field>
</record>
<record id="base.GEL" model="res.currency">
<field name="iso_numeric">981</field>
</record>
<record id="base.GHS" model="res.currency">
<field name="iso_numeric">936</field>
</record>
<record id="base.GIP" model="res.currency">
<field name="iso_numeric">292</field>
</record>
<record id="base.GTQ" model="res.currency">
<field name="iso_numeric">320</field>
</record>
<record id="base.GBP" model="res.currency">
<field name="iso_numeric">826</field>
</record>
<record id="base.GNF" model="res.currency">
<field name="iso_numeric">324</field>
</record>
<record id="base.GYD" model="res.currency">
<field name="iso_numeric">328</field>
</record>
<record id="base.HTG" model="res.currency">
<field name="iso_numeric">332</field>
</record>
<record id="base.HNL" model="res.currency">
<field name="iso_numeric">340</field>
</record>
<record id="base.HKD" model="res.currency">
<field name="iso_numeric">344</field>
</record>
<record id="base.HUF" model="res.currency">
<field name="iso_numeric">348</field>
</record>
<record id="base.ISK" model="res.currency">
<field name="iso_numeric">352</field>
</record>
<record id="base.IDR" model="res.currency">
<field name="iso_numeric">360</field>
</record>
<record id="base.IRR" model="res.currency">
<field name="iso_numeric">364</field>
</record>
<record id="base.IQD" model="res.currency">
<field name="iso_numeric">368</field>
</record>
<record id="base.ILS" model="res.currency">
<field name="iso_numeric">376</field>
</record>
<record id="base.JMD" model="res.currency">
<field name="iso_numeric">388</field>
</record>
<record id="base.JPY" model="res.currency">
<field name="iso_numeric">392</field>
</record>
<record id="base.JOD" model="res.currency">
<field name="iso_numeric">400</field>
</record>
<record id="base.KZT" model="res.currency">
<field name="iso_numeric">398</field>
</record>
<record id="base.KES" model="res.currency">
<field name="iso_numeric">404</field>
</record>
<record id="base.KPW" model="res.currency">
<field name="iso_numeric">408</field>
</record>
<record id="base.KRW" model="res.currency">
<field name="iso_numeric">410</field>
</record>
<record id="base.KWD" model="res.currency">
<field name="iso_numeric">414</field>
</record>
<record id="base.KGS" model="res.currency">
<field name="iso_numeric">417</field>
</record>
<record id="base.LAK" model="res.currency">
<field name="iso_numeric">418</field>
</record>
<record id="base.LBP" model="res.currency">
<field name="iso_numeric">422</field>
</record>
<record id="base.LSL" model="res.currency">
<field name="iso_numeric">426</field>
</record>
<record id="base.ZAR" model="res.currency">
<field name="iso_numeric">710</field>
</record>
<record id="base.LRD" model="res.currency">
<field name="iso_numeric">430</field>
</record>
<record id="base.LYD" model="res.currency">
<field name="iso_numeric">434</field>
</record>
<record id="base.CHF" model="res.currency">
<field name="iso_numeric">756</field>
</record>
<record id="base.LTL" model="res.currency">
<field name="iso_numeric">440</field>
</record>
<record id="base.MOP" model="res.currency">
<field name="iso_numeric">446</field>
</record>
<record id="base.MKD" model="res.currency">
<field name="iso_numeric">807</field>
</record>
<record id="base.MGA" model="res.currency">
<field name="iso_numeric">969</field>
</record>
<record id="base.MWK" model="res.currency">
<field name="iso_numeric">454</field>
</record>
<record id="base.MYR" model="res.currency">
<field name="iso_numeric">458</field>
</record>
<record id="base.MVR" model="res.currency">
<field name="iso_numeric">462</field>
</record>
<record id="base.MRO" model="res.currency">
<field name="iso_numeric">478</field>
</record>
<record id="base.MUR" model="res.currency">
<field name="iso_numeric">480</field>
</record>
<record id="base.MXN" model="res.currency">
<field name="iso_numeric">484</field>
</record>
<record id="base.MDL" model="res.currency">
<field name="iso_numeric">498</field>
</record>
<record id="base.MNT" model="res.currency">
<field name="iso_numeric">496</field>
</record>
<record id="base.MAD" model="res.currency">
<field name="iso_numeric">504</field>
</record>
<record id="base.MZN" model="res.currency">
<field name="iso_numeric">943</field>
</record>
<record id="base.MMK" model="res.currency">
<field name="iso_numeric">104</field>
</record>
<record id="base.NAD" model="res.currency">
<field name="iso_numeric">516</field>
</record>
<record id="base.NPR" model="res.currency">
<field name="iso_numeric">524</field>
</record>
<record id="base.NIO" model="res.currency">
<field name="iso_numeric">558</field>
</record>
<record id="base.NGN" model="res.currency">
<field name="iso_numeric">566</field>
</record>
<record id="base.OMR" model="res.currency">
<field name="iso_numeric">512</field>
</record>
<record id="base.PKR" model="res.currency">
<field name="iso_numeric">586</field>
</record>
<record id="base.PAB" model="res.currency">
<field name="iso_numeric">590</field>
</record>
<record id="base.PGK" model="res.currency">
<field name="iso_numeric">598</field>
</record>
<record id="base.PYG" model="res.currency">
<field name="iso_numeric">600</field>
</record>
<record id="base.PEN" model="res.currency">
<field name="iso_numeric">604</field>
</record>
<record id="base.PHP" model="res.currency">
<field name="iso_numeric">608</field>
</record>
<record id="base.PLN" model="res.currency">
<field name="iso_numeric">985</field>
</record>
<record id="base.QAR" model="res.currency">
<field name="iso_numeric">634</field>
</record>
<record id="base.RON" model="res.currency">
<field name="iso_numeric">946</field>
</record>
<record id="base.RUB" model="res.currency">
<field name="iso_numeric">643</field>
</record>
<record id="base.RWF" model="res.currency">
<field name="iso_numeric">646</field>
</record>
<record id="base.SHP" model="res.currency">
<field name="iso_numeric">654</field>
</record>
<record id="base.WST" model="res.currency">
<field name="iso_numeric">882</field>
</record>
<record id="base.STD" model="res.currency">
<field name="iso_numeric">678</field>
</record>
<record id="base.SAR" model="res.currency">
<field name="iso_numeric">682</field>
</record>
<record id="base.RSD" model="res.currency">
<field name="iso_numeric">941</field>
</record>
<record id="base.SCR" model="res.currency">
<field name="iso_numeric">690</field>
</record>
<record id="base.SLL" model="res.currency">
<field name="iso_numeric">694</field>
</record>
<record id="base.SGD" model="res.currency">
<field name="iso_numeric">702</field>
</record>
<record id="base.SBD" model="res.currency">
<field name="iso_numeric">090</field>
</record>
<record id="base.SSP" model="res.currency">
<field name="iso_numeric">728</field>
</record>
<record id="base.LKR" model="res.currency">
<field name="iso_numeric">144</field>
</record>
<record id="base.SZL" model="res.currency">
<field name="iso_numeric">748</field>
</record>
<record id="base.SEK" model="res.currency">
<field name="iso_numeric">752</field>
</record>
<record id="base.SYP" model="res.currency">
<field name="iso_numeric">760</field>
</record>
<record id="base.TWD" model="res.currency">
<field name="iso_numeric">901</field>
</record>
<record id="base.TZS" model="res.currency">
<field name="iso_numeric">834</field>
</record>
<record id="base.THB" model="res.currency">
<field name="iso_numeric">764</field>
</record>
<record id="base.TOP" model="res.currency">
<field name="iso_numeric">776</field>
</record>
<record id="base.TTD" model="res.currency">
<field name="iso_numeric">780</field>
</record>
<record id="base.TND" model="res.currency">
<field name="iso_numeric">788</field>
</record>
<record id="base.TRY" model="res.currency">
<field name="iso_numeric">949</field>
</record>
<record id="base.UGX" model="res.currency">
<field name="iso_numeric">800</field>
</record>
<record id="base.UAH" model="res.currency">
<field name="iso_numeric">980</field>
</record>
<record id="base.AED" model="res.currency">
<field name="iso_numeric">784</field>
</record>
<record id="base.UYU" model="res.currency">
<field name="iso_numeric">858</field>
</record>
<record id="base.UZS" model="res.currency">
<field name="iso_numeric">860</field>
</record>
<record id="base.VUV" model="res.currency">
<field name="iso_numeric">548</field>
</record>
<record id="base.VEF" model="res.currency">
<field name="iso_numeric">937</field>
</record>
<record id="base.VND" model="res.currency">
<field name="iso_numeric">704</field>
</record>
<record id="base.YER" model="res.currency">
<field name="iso_numeric">886</field>
</record>
</data>
</openerp>

37
currency_iso_numeric/res_currency_view.xml

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="view_currency_form" model="ir.ui.view">
<field name="name">add.iso.numeric.res.currency.form</field>
<field name="model">res.currency</field>
<field name="inherit_id" ref="base.view_currency_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="iso_numeric"/>
</field>
</field>
</record>
<record id="view_currency_tree" model="ir.ui.view">
<field name="name">add.iso.numeric.res.currency.tree</field>
<field name="model">res.currency</field>
<field name="inherit_id" ref="base.view_currency_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="iso_numeric"/>
</field>
</field>
</record>
</data>
</openerp>

1
hw_customer_display/__openerp__.py

@ -62,5 +62,4 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
'python': ['serial', 'unidecode'],
},
'data': [],
'active': False,
}

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:

97
pos_payment_terminal/static/src/js/pos_payment_terminal.js

@ -2,84 +2,49 @@ 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){
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)});
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)});
},
});
});
//TODO make the button bigger and with better name
//TODO make the button bigger and with better name
var _super_PaymentScreenWidget_init_ = module.PaymentScreenWidget.prototype.init;
module.PaymentScreenWidget.prototype.init = function(parent, options){
_super_PaymentScreenWidget_init_.call(this, parent, options);
self = this;
this.payment_terminal_transaction_start = function(event){
var node = this;
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);
}
event.stopPropagation();
};
};
self = this;
this.payment_terminal_transaction_start = function(event){
var node = this;
while (node && !node.classList.contains('paymentline')){
node = node.parentNode;
}
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();
};
};
var _super_renderPaymentline_ = module.PaymentScreenWidget.prototype.render_paymentline;
module.PaymentScreenWidget.prototype.render_paymentline = function(line){
var el_node = _super_renderPaymentline_.call(this, line);
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'])
.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;
});
}
if (!this.pos.currency.name){
var self = this;
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;
});
}
el_node.querySelector('.payment-terminal-transaction-start')
.addEventListener('click', this.payment_terminal_transaction_start);
}
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,'');
.addEventListener('click', this.payment_terminal_transaction_start);
}
return el_node;
};
*/
};
Loading…
Cancel
Save