[tryton-debian-vcs] tryton-modules-bank branch upstream updated. upstream/3.0.1-1-gbf6ac8c

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Tue Apr 22 13:06:24 UTC 2014


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-bank.git;a=commitdiff;h=upstream/3.0.1-1-gbf6ac8c

commit bf6ac8cffa9c1bb37e35477bb1ee034178ab6b85
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Apr 22 14:21:14 2014 +0200

    Adding upstream version 3.2.0.

diff --git a/CHANGELOG b/CHANGELOG
index be7289e..8d5871c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,7 @@
-Version 3.0.1 - 2013-12-04
+Version 3.2.0 - 2014-04-21
 * Bug fixes (see mercurial logs for details)
+* Add IBAN format, validation and compact
+* Add default access rights
 
 Version 3.0.0 - 2013-10-21
-* Initial release
\ No newline at end of file
+* Initial release
diff --git a/COPYRIGHT b/COPYRIGHT
index 1ef62b0..f8646f0 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2013 Cédric Krier.
-Copyright (C) 2013 B2CK SPRL.
+Copyright (C) 2013-2014 Cédric Krier.
+Copyright (C) 2013-2014 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/INSTALL b/INSTALL
index f79193c..f12bee4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ Installing trytond_bank
 Prerequisites
 -------------
 
- * Python 2.6 or later (http://www.python.org/)
+ * Python 2.7 or later (http://www.python.org/)
  * trytond (http://www.tryton.org/)
  * trytond_party (http://www.tryton.org/)
  * trytond_currency (http://www.tryton.org/)
diff --git a/MANIFEST.in b/MANIFEST.in
index 2569955..e013c00 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,12 +1,10 @@
 include INSTALL
 include README
-include TODO
 include COPYRIGHT
 include CHANGELOG
 include LICENSE
 include tryton.cfg
 include *.xml
 include view/*.xml
-include *.odt
 include locale/*.po
 include doc/*
diff --git a/PKG-INFO b/PKG-INFO
index 8a5b162..8fb45d3 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_bank
-Version: 3.0.1
+Version: 3.2.0
 Summary: Tryton module with banks
 Home-page: http://www.tryton.org/
 Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
 Description: trytond_bank
         ============
         
@@ -43,9 +43,11 @@ Description: trytond_bank
         
           http://www.tryton.org/
         
+Keywords: tryton bank
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Plugins
+Classifier: Framework :: Tryton
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
@@ -62,6 +64,5 @@ Classifier: Natural Language :: Russian
 Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Topic :: Office/Business
diff --git a/bank.py b/bank.py
index 0a4458a..0fd9a9c 100644
--- a/bank.py
+++ b/bank.py
@@ -1,5 +1,7 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
+from stdnum import iban
+
 from trytond.model import ModelView, ModelSQL, fields
 
 
@@ -54,16 +56,60 @@ class BankAccountNumber(ModelSQL, ModelView):
         super(BankAccountNumber, cls).__setup__()
         cls._order.insert(0, ('account', 'ASC'))
         cls._order.insert(1, ('sequence', 'ASC'))
+        cls._error_messages.update({
+                'invalid_iban': 'Invalid IBAN "%s".',
+                })
 
     @staticmethod
     def order_sequence(tables):
         table, _ = tables[None]
         return [table.sequence == None, table.sequence]
 
-    # TODO validate IBAN
+    @property
+    def compact_iban(self):
+        return (iban.compact(self.number) if self.type == 'iban'
+            else self.number)
 
+    @classmethod
+    def create(cls, vlist):
+        vlist = [v.copy() for v in vlist]
+        for values in vlist:
+            if values.get('type') == 'iban' and 'number' in values:
+                values['number'] = iban.format(values['number'])
+        return super(BankAccountNumber, cls).create(vlist)
 
-class BankAccountParty(ModelSQL, ModelView):
+    @classmethod
+    def write(cls, *args):
+        actions = iter(args)
+        args = []
+        for numbers, values in zip(actions, actions):
+            values = values.copy()
+            if values.get('type') == 'iban' and 'number' in values:
+                values['number'] = iban.format(values['number'])
+            args.extend((numbers, values))
+
+        super(BankAccountNumber, cls).write(*args)
+
+        to_write = []
+        for number in sum(args[::2], []):
+            if number.type == 'iban':
+                formated_number = iban.format(number.number)
+                if formated_number != number.number:
+                    to_write.extend(([number], {
+                                'number': formated_number,
+                                }))
+        if to_write:
+            cls.write(*to_write)
+
+    @fields.depends('type', 'number')
+    def pre_validate(self):
+        super(BankAccountNumber, self).pre_validate()
+        if (self.type == 'iban' and self.number
+                and not iban.is_valid(self.number)):
+            self.raise_user_error('invalid_iban', self.number)
+
+
+class BankAccountParty(ModelSQL):
     'Bank Account - Party'
     __name__ = 'bank.account-party.party'
     account = fields.Many2One('bank.account', 'Account',
diff --git a/bank.xml b/bank.xml
index 8762cb0..a4e3048 100644
--- a/bank.xml
+++ b/bank.xml
@@ -3,6 +3,18 @@
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
+        <record model="res.group" id="group_bank_admin">
+            <field name="name">Bank Administration</field>
+        </record>
+        <record model="res.user-res.group" id="user_admin_group_bank_admin">
+            <field name="user" ref="res.user_admin"/>
+            <field name="group" ref="group_bank_admin"/>
+        </record>
+        <record model="res.user-res.group" id="user_trigger_group_bank_admin">
+            <field name="user" ref="res.user_trigger"/>
+            <field name="group" ref="group_bank_admin"/>
+        </record>
+
         <menuitem name="Banking" sequence="3" id="menu_banking"/>
 
         <record model="ir.ui.view" id="bank_view_form">
@@ -34,6 +46,22 @@ this repository contains the full copyright notices and license terms. -->
         <menuitem parent="menu_banking" action="act_bank_form"
             sequence="10" id="menu_bank_form"/>
 
+        <record model="ir.model.access" id="access_bank">
+            <field name="model" search="[('model', '=', 'bank')]"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="False"/>
+            <field name="perm_create" eval="False"/>
+            <field name="perm_delete" eval="False"/>
+        </record>
+        <record model="ir.model.access" id="access_bank_bank_admin">
+            <field name="model" search="[('model', '=', 'bank')]"/>
+            <field name="group" ref="group_bank_admin"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="True"/>
+            <field name="perm_create" eval="True"/>
+            <field name="perm_delete" eval="True"/>
+        </record>
+
         <record model="ir.ui.view" id="bank_account_view_form">
             <field name="model">bank.account</field>
             <field name="type">form</field>
@@ -65,6 +93,22 @@ this repository contains the full copyright notices and license terms. -->
         <menuitem parent="menu_banking" action="act_bank_account_form"
             sequence="20" id="menu_bank_account_form"/>
 
+        <record model="ir.model.access" id="access_account">
+            <field name="model" search="[('model', '=', 'bank.account')]"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="False"/>
+            <field name="perm_create" eval="False"/>
+            <field name="perm_delete" eval="False"/>
+        </record>
+        <record model="ir.model.access" id="access_account_bank_admin">
+            <field name="model" search="[('model', '=', 'bank.account')]"/>
+            <field name="group" ref="group_bank_admin"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="True"/>
+            <field name="perm_create" eval="True"/>
+            <field name="perm_delete" eval="True"/>
+        </record>
+
         <record model="ir.ui.view" id="bank_account_number_view_form">
             <field name="model">bank.account.number</field>
             <field name="type">form</field>
@@ -81,5 +125,20 @@ this repository contains the full copyright notices and license terms. -->
             <field name="name">bank_account_number_list_sequence</field>
         </record>
 
+        <record model="ir.model.access" id="access_account_number">
+            <field name="model" search="[('model', '=', 'bank.account.number')]"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="False"/>
+            <field name="perm_create" eval="False"/>
+            <field name="perm_delete" eval="False"/>
+        </record>
+        <record model="ir.model.access" id="access_account_number_bank_admin">
+            <field name="model" search="[('model', '=', 'bank.account.number')]"/>
+            <field name="group" ref="group_bank_admin"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="True"/>
+            <field name="perm_create" eval="True"/>
+            <field name="perm_delete" eval="True"/>
+        </record>
     </data>
 </tryton>
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 2fcbf8e..1158905 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "IBAN no vàlid \"%s\"."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "BIC"
@@ -92,7 +96,7 @@ msgstr "ID"
 
 msgctxt "field:bank.account-party.party,owner:"
 msgid "Owner"
-msgstr "Propietari"
+msgstr "Titular"
 
 msgctxt "field:bank.account-party.party,rec_name:"
 msgid "Name"
@@ -152,7 +156,7 @@ msgstr "Comptes bancaris"
 
 msgctxt "help:bank,bic:"
 msgid "Bank/Business Identifier Code"
-msgstr "Codi Identificador de Banc/Negoci (BIC)"
+msgstr "Codi Identificador de Banc/Negoci (BIC)."
 
 msgctxt "model:bank,name:"
 msgid "Bank"
@@ -190,6 +194,10 @@ msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
 msgstr "Banca"
 
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Administració de bancs"
+
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
 msgstr "IBAN"
@@ -224,4 +232,4 @@ msgstr "Bancs"
 
 msgctxt "view:party.party:"
 msgid "Banking"
-msgstr "Bancs"
+msgstr "Banca"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index e8272a7..baa8af7 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "Ungültige IBAN \"%s\"."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "BIC"
@@ -190,6 +194,10 @@ msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
 msgstr "Banking"
 
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Bank Administration"
+
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
 msgstr "IBAN"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index c349998..1772a18 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "IBAN «%s» incorrecto."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "CIB"
@@ -188,7 +192,11 @@ msgstr "Bancos"
 
 msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
-msgstr "Banca"
+msgstr "Bancos"
+
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Administración de bancos"
 
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
@@ -224,4 +232,4 @@ msgstr "Bancos"
 
 msgctxt "view:party.party:"
 msgid "Banking"
-msgstr "Banca"
+msgstr "Bancos"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index d65c279..2af7dec 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "Inválido IBAN \"%s\"."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "CIB"
@@ -20,11 +24,11 @@ msgstr "ID"
 
 msgctxt "field:bank,party:"
 msgid "Party"
-msgstr "Terceros"
+msgstr "Tercero"
 
 msgctxt "field:bank,rec_name:"
 msgid "Name"
-msgstr "Nombre del campo"
+msgstr "Nombre"
 
 msgctxt "field:bank,write_date:"
 msgid "Write Date"
@@ -36,7 +40,7 @@ msgstr "Modificado por Usuario"
 
 msgctxt "field:bank.account,bank:"
 msgid "Bank"
-msgstr "Banca"
+msgstr "Banco"
 
 msgctxt "field:bank.account,create_date:"
 msgid "Create Date"
@@ -68,7 +72,7 @@ msgstr "Nombre"
 
 msgctxt "field:bank.account,write_date:"
 msgid "Write Date"
-msgstr "Modificado por Usuario"
+msgstr "Fecha de Modificación"
 
 msgctxt "field:bank.account,write_uid:"
 msgid "Write User"
@@ -96,11 +100,11 @@ msgstr "Propietario"
 
 msgctxt "field:bank.account-party.party,rec_name:"
 msgid "Name"
-msgstr "Nombre del campo"
+msgstr "Nombre"
 
 msgctxt "field:bank.account-party.party,write_date:"
 msgid "Write Date"
-msgstr "Modificado por Usuario"
+msgstr "Fecha de Modificación"
 
 msgctxt "field:bank.account-party.party,write_uid:"
 msgid "Write User"
@@ -140,7 +144,7 @@ msgstr "Tipo"
 
 msgctxt "field:bank.account.number,write_date:"
 msgid "Write Date"
-msgstr "Modificado por Usuario"
+msgstr "Fecha de Modificación"
 
 msgctxt "field:bank.account.number,write_uid:"
 msgid "Write User"
@@ -180,15 +184,19 @@ msgstr "Bancos"
 
 msgctxt "model:ir.ui.menu,name:menu_bank_account_form"
 msgid "Accounts"
-msgstr "Cuentas"
+msgstr "Cuentas Bancarias"
 
 msgctxt "model:ir.ui.menu,name:menu_bank_form"
 msgid "Banks"
-msgstr "Bancos"
+msgstr "Banco"
 
 msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
-msgstr "Banco"
+msgstr "Bancos"
+
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Administración de Bancos"
 
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
@@ -216,7 +224,7 @@ msgstr "Cuentas Bancaria"
 
 msgctxt "view:bank:"
 msgid "Bank"
-msgstr "Banco"
+msgstr "Bancos"
 
 msgctxt "view:bank:"
 msgid "Banks"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index ed84fc4..4aca89d 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "IBAN no válido \"%s\"."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "BIC"
@@ -56,7 +60,7 @@ msgstr "ID"
 
 msgctxt "field:bank.account,numbers:"
 msgid "Numbers"
-msgstr "Número"
+msgstr "Números"
 
 msgctxt "field:bank.account,owners:"
 msgid "Owners"
@@ -92,7 +96,7 @@ msgstr "ID"
 
 msgctxt "field:bank.account-party.party,owner:"
 msgid "Owner"
-msgstr "Propietario"
+msgstr "Titular"
 
 msgctxt "field:bank.account-party.party,rec_name:"
 msgid "Name"
@@ -152,7 +156,7 @@ msgstr "Cuentas bancarias"
 
 msgctxt "help:bank,bic:"
 msgid "Bank/Business Identifier Code"
-msgstr "Código Identificador de Banco/Negocio (BIC)"
+msgstr "Código Identificador de Banco/Negocio (BIC)."
 
 msgctxt "model:bank,name:"
 msgid "Bank"
@@ -190,6 +194,10 @@ msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
 msgstr "Banca"
 
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Administración de bancos"
+
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
 msgstr "IBAN"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index c49ee75..bbe1426 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "IBAN invalide \"%s\"."
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "BIC"
@@ -48,7 +52,7 @@ msgstr "Créé par"
 
 msgctxt "field:bank.account,currency:"
 msgid "Currency"
-msgstr "Devises"
+msgstr "Devise"
 
 msgctxt "field:bank.account,id:"
 msgid "ID"
@@ -190,6 +194,10 @@ msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
 msgstr "Banque"
 
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Administration des banques"
+
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
 msgstr "IBAN"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 10eca48..5638dd0 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -2,6 +2,10 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=utf-8\n"
 
+msgctxt "error:bank.account.number:"
+msgid "Invalid IBAN \"%s\"."
+msgstr "Neveljave IBAN \"%s\""
+
 msgctxt "field:bank,bic:"
 msgid "BIC"
 msgstr "BIC"
@@ -20,7 +24,7 @@ msgstr "ID"
 
 msgctxt "field:bank,party:"
 msgid "Party"
-msgstr "Stranka"
+msgstr "Partner"
 
 msgctxt "field:bank,rec_name:"
 msgid "Name"
@@ -164,7 +168,7 @@ msgstr "Bančni račun"
 
 msgctxt "model:bank.account-party.party,name:"
 msgid "Bank Account - Party"
-msgstr "Bančni račun - Stranka"
+msgstr "Bančni račun - Partner"
 
 msgctxt "model:bank.account.number,name:"
 msgid "Bank Account Number"
@@ -190,6 +194,10 @@ msgctxt "model:ir.ui.menu,name:menu_banking"
 msgid "Banking"
 msgstr "Bančništvo"
 
+msgctxt "model:res.group,name:group_bank_admin"
+msgid "Bank Administration"
+msgstr "Bančništvo - vodenje"
+
 msgctxt "selection:bank.account.number,type:"
 msgid "IBAN"
 msgstr "IBAN"
diff --git a/party.xml b/party.xml
index e5c6732..fdcfd5d 100644
--- a/party.xml
+++ b/party.xml
@@ -8,5 +8,22 @@ this repository contains the full copyright notices and license terms. -->
             <field name="inherit" ref="party.party_view_form"/>
             <field name="name">party_form</field>
         </record>
+
+        <record model="ir.model.field.access" id="access_party_bank_accounts">
+            <field name="field" search="[('model.model', '=', 'party.party'), ('name', '=', 'bank_accounts')]"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="False"/>
+            <field name="perm_create" eval="False"/>
+            <field name="perm_delete" eval="False"/>
+        </record>
+        <record model="ir.model.field.access"
+            id="access_party_bank_accounts_bank_admin">
+            <field name="field" search="[('model.model', '=', 'party.party'), ('name', '=', 'bank_accounts')]"/>
+            <field name="group" ref="group_bank_admin"/>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="True"/>
+            <field name="perm_create" eval="True"/>
+            <field name="perm_delete" eval="True"/>
+        </record>
     </data>
 </tryton>
diff --git a/setup.py b/setup.py
index e214f2d..a912803 100644
--- a/setup.py
+++ b/setup.py
@@ -11,33 +11,51 @@ import ConfigParser
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
+
+def get_require_version(name):
+    if minor_version % 2:
+        require = '%s >= %s.%s.dev0, < %s.%s'
+    else:
+        require = '%s >= %s.%s, < %s.%s'
+    require %= (name, major_version, minor_version,
+        major_version, minor_version + 1)
+    return require
+
 config = ConfigParser.ConfigParser()
 config.readfp(open('tryton.cfg'))
 info = dict(config.items('tryton'))
 for key in ('depends', 'extras_depend', 'xml'):
     if key in info:
         info[key] = info[key].strip().splitlines()
-major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
+version = info.get('version', '0.0.1')
+major_version, minor_version, _ = version.split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
+name = 'trytond_bank'
+
+download_url = 'http://downloads.tryton.org/%s.%s/' % (
+    major_version, minor_version)
+if minor_version % 2:
+    version = '%s.%s.dev0' % (major_version, minor_version)
+    download_url = (
+        'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
+            name[8:], name, version))
 
-requires = []
+requires = ['python-stdnum']
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
-        requires.append('trytond_%s >= %s.%s, < %s.%s' %
-            (dep, major_version, minor_version, major_version,
-                minor_version + 1))
-requires.append('trytond >= %s.%s, < %s.%s' %
-    (major_version, minor_version, major_version, minor_version + 1))
+        requires.append(get_require_version('trytond_%s' % dep))
+requires.append(get_require_version('trytond'))
 
-setup(name='trytond_bank',
-    version=info.get('version', '0.0.1'),
+setup(name=name,
+    version=version,
     description='Tryton module with banks',
     long_description=read('README'),
     author='Tryton',
+    author_email='issue_tracker at tryton.org',
     url='http://www.tryton.org/',
-    download_url=("http://downloads.tryton.org/" +
-        info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
+    download_url=download_url,
+    keywords='tryton bank',
     package_dir={'trytond.modules.bank': '.'},
     packages=[
         'trytond.modules.bank',
@@ -50,6 +68,7 @@ setup(name='trytond_bank',
     classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Environment :: Plugins',
+        'Framework :: Tryton',
         'Intended Audience :: Developers',
         'Intended Audience :: Financial and Insurance Industry',
         'Intended Audience :: Legal Industry',
@@ -66,7 +85,6 @@ setup(name='trytond_bank',
         'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Topic :: Office/Business',
         ],
diff --git a/tests/test_bank.py b/tests/test_bank.py
index e930395..ed6f85e 100644
--- a/tests/test_bank.py
+++ b/tests/test_bank.py
@@ -1,44 +1,75 @@
-#!/usr/bin/env python
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
-import sys
-import os
-DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
-    '..', '..', '..', '..', '..', 'trytond')))
-if os.path.isdir(DIR):
-    sys.path.insert(0, os.path.dirname(DIR))
-
 import unittest
 import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import test_view, test_depends, \
+    POOL, DB_NAME, USER, CONTEXT
+from trytond.transaction import Transaction
 
 
 class BankTestCase(unittest.TestCase):
-    '''
-    Test Bank module.
-    '''
+    'Test Bank module'
 
     def setUp(self):
         trytond.tests.test_tryton.install_module('bank')
+        self.bank = POOL.get('bank')
+        self.party = POOL.get('party.party')
+        self.account = POOL.get('bank.account')
+        self.number = POOL.get('bank.account.number')
 
     def test0005views(self):
-        '''
-        Test views.
-        '''
+        'Test views'
         test_view('bank')
 
     def test0006depends(self):
-        '''
-        Test depends.
-        '''
+        'Test depends'
         test_depends()
 
+    def test0010iban_format(self):
+        'Test IBAN format'
+        with Transaction().start(DB_NAME, USER, context=CONTEXT):
+            party = self.party(name='Test')
+            party.save()
+            bank = self.bank(party=party)
+            bank.save()
+            account, = self.account.create([{
+                        'bank': bank.id,
+                        'numbers': [('create', [{
+                                        'type': 'iban',
+                                        'number': 'BE82068896274468',
+                                        }, {
+                                        'type': 'other',
+                                        'number': 'not IBAN',
+                                        }])],
+                        }])
+
+            iban_number, other_number = account.numbers
+            self.assertEqual(iban_number.type, 'iban')
+            self.assertEqual(other_number.type, 'other')
+
+            # Test format on create
+            self.assertEqual(iban_number.number, 'BE82 0688 9627 4468')
+            self.assertEqual(other_number.number, 'not IBAN')
+
+            # Test format on write
+            iban_number.number = 'BE82068896274468'
+            iban_number.type = 'iban'
+            iban_number.save()
+            self.assertEqual(iban_number.number, 'BE82 0688 9627 4468')
+
+            other_number.number = 'still not IBAN'
+            other_number.save()
+            self.assertEqual(other_number.number, 'still not IBAN')
+
+            self.number.write([iban_number, other_number], {
+                    'number': 'BE82068896274468',
+                    })
+            self.assertEqual(iban_number.number, 'BE82 0688 9627 4468')
+            self.assertEqual(other_number.number, 'BE82068896274468')
+
 
 def suite():
     suite = trytond.tests.test_tryton.suite()
     suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
             BankTestCase))
     return suite
-
-if __name__ == '__main__':
-    unittest.TextTestRunner(verbosity=2).run(suite())
diff --git a/tryton.cfg b/tryton.cfg
index a261c18..f2bee46 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.0.1
+version=3.2.0
 depends:
     ir
     party
diff --git a/trytond_bank.egg-info/PKG-INFO b/trytond_bank.egg-info/PKG-INFO
index c58e69c..e731258 100644
--- a/trytond_bank.egg-info/PKG-INFO
+++ b/trytond_bank.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-bank
-Version: 3.0.1
+Version: 3.2.0
 Summary: Tryton module with banks
 Home-page: http://www.tryton.org/
 Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
 Description: trytond_bank
         ============
         
@@ -43,9 +43,11 @@ Description: trytond_bank
         
           http://www.tryton.org/
         
+Keywords: tryton bank
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Plugins
+Classifier: Framework :: Tryton
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
@@ -62,6 +64,5 @@ Classifier: Natural Language :: Russian
 Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Topic :: Office/Business
diff --git a/trytond_bank.egg-info/requires.txt b/trytond_bank.egg-info/requires.txt
index bd5f290..14a05cf 100644
--- a/trytond_bank.egg-info/requires.txt
+++ b/trytond_bank.egg-info/requires.txt
@@ -1,3 +1,4 @@
-trytond_party >= 3.0, < 3.1
-trytond_currency >= 3.0, < 3.1
-trytond >= 3.0, < 3.1
\ No newline at end of file
+python-stdnum
+trytond_party >= 3.2, < 3.3
+trytond_currency >= 3.2, < 3.3
+trytond >= 3.2, < 3.3
\ No newline at end of file
diff --git a/view/bank_account_form.xml b/view/bank_account_form.xml
index bf90fa1..cc4b561 100644
--- a/view/bank_account_form.xml
+++ b/view/bank_account_form.xml
@@ -7,6 +7,6 @@ this repository contains the full copyright notices and license terms. -->
     <label name="currency"/>
     <field name="currency"/>
     <field name="owners" colspan="4"/>
-    <field name="numbers" colspan="4"
+    <field name="numbers" colspan="4" pre_validate="1"
         view_ids="bank.bank_account_number_view_list_sequence"/>
 </form>
-- 
tryton-modules-bank



More information about the tryton-debian-vcs mailing list