Merge lp:~therp-nl/banking-addons/6.1-dev-preserve-domestic into lp:~banking-addons-team/banking-addons/6.1-dev

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Approved by: James Jesudason
Approved revision: 109
Merge reported by: James Jesudason
Merged at revision: not available
Proposed branch: lp:~therp-nl/banking-addons/6.1-dev-preserve-domestic
Merge into: lp:~banking-addons-team/banking-addons/6.1-dev
Diff against target: 598 lines (+241/-104)
10 files modified
account_banking/__openerp__.py (+5/-1)
account_banking/account_banking.py (+90/-63)
account_banking/account_banking_view.xml (+27/-16)
account_banking/banking_import_transaction.py (+1/-1)
account_banking/data/account_banking_data.xml (+0/-18)
account_banking/wizard/banktools.py (+7/-5)
account_iban_preserve_domestic/__init__.py (+1/-0)
account_iban_preserve_domestic/__openerp__.py (+61/-0)
account_iban_preserve_domestic/res_partner_bank.py (+12/-0)
account_iban_preserve_domestic/res_partner_bank_view.xml (+37/-0)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/6.1-dev-preserve-domestic
Reviewer Review Type Date Requested Status
James Jesudason (community) Approve
Review via email: mp+93746@code.launchpad.net

Description of the change

Adapt to changes in base_iban: preserve the domestic account number

To post a comment you must log in.
Revision history for this message
James Jesudason (jamesj) wrote :

The license for preserve domestic module needs to be 'AGPL-3' (not AGPL), otherwise this looks fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_banking/__openerp__.py'
--- account_banking/__openerp__.py 2012-02-01 15:36:09 +0000
+++ account_banking/__openerp__.py 2012-02-19 21:14:20 +0000
@@ -35,7 +35,8 @@
35 'author': 'Banking addons community',35 'author': 'Banking addons community',
36 'website': 'https://launchpad.net/banking-addons',36 'website': 'https://launchpad.net/banking-addons',
37 'category': 'Banking addons',37 'category': 'Banking addons',
38 'depends': ['base', 'account', 'base_iban', 'account_payment'],38 'depends': ['base', 'account', 'base_iban', 'account_payment',
39 'account_iban_preserve_domestic'],
39 'init_xml': [],40 'init_xml': [],
40 'update_xml': [41 'update_xml': [
41 'security/ir.model.access.csv',42 'security/ir.model.access.csv',
@@ -47,6 +48,9 @@
47 'workflow/account_invoice.xml',48 'workflow/account_invoice.xml',
48 ],49 ],
49 'demo_xml': [],50 'demo_xml': [],
51 'external_dependencies': {
52 'python' : ['BeautifulSoup'],
53 },
50 'description': '''54 'description': '''
51 Module to do banking.55 Module to do banking.
5256
5357
=== modified file 'account_banking/account_banking.py'
--- account_banking/account_banking.py 2012-02-17 23:36:43 +0000
+++ account_banking/account_banking.py 2012-02-19 21:14:20 +0000
@@ -66,6 +66,7 @@
66import decimal_precision as dp66import decimal_precision as dp
67import pooler67import pooler
68import netsvc68import netsvc
69from openerp import SUPERUSER_ID
6970
70def warning(title, message):71def warning(title, message):
71 '''Convenience routine'''72 '''Convenience routine'''
@@ -1070,11 +1071,6 @@
1070 using IBAN specs.1071 using IBAN specs.
1071 '''1072 '''
1072 _inherit = 'res.partner.bank'1073 _inherit = 'res.partner.bank'
1073 _columns = {
1074 'iban': fields.char('IBAN', size=34,
1075 help="International Bank Account Number"
1076 ),
1077 }
10781074
1079 def __init__(self, *args, **kwargs):1075 def __init__(self, *args, **kwargs):
1080 '''1076 '''
@@ -1091,61 +1087,64 @@
1091 self._founder = mro[i]1087 self._founder = mro[i]
1092 break1088 break
10931089
1094 def init(self, cursor):1090 def init(self, cr):
1095 '''1091 '''
1096 Update existing iban accounts to comply to new regime1092 Update existing iban accounts to comply to new regime
1097 Note that usage of the ORM is not possible here, as the ORM cannot1093 Note that usage of the ORM is not possible here, as the ORM cannot
1098 search on values not provided by the client.1094 search on values not provided by the client.
1099 '''1095 '''
1100 cursor.execute('SELECT id, acc_number, iban '1096
1101 'FROM res_partner_bank '1097 partner_bank_obj = self.pool.get('res.partner.bank')
1102 'WHERE '1098 bank_ids = partner_bank_obj.search(
1103 'upper(iban) != iban OR '1099 cr, SUPERUSER_ID, [('state', '=', 'iban')], limit=0)
1104 'acc_number IS NULL'1100 for bank in partner_bank_obj.read(cr, SUPERUSER_ID, bank_ids):
1105 )1101 write_vals = {}
1106 for id, acc_number, iban in cursor.fetchall():1102 if bank['state'] == 'iban':
1107 new_iban = new_acc_number = False1103 iban_acc = sepa.IBAN(bank['acc_number'])
1108 if iban:
1109 iban_acc = sepa.IBAN(iban)
1110 if iban_acc.valid:1104 if iban_acc.valid:
1111 new_acc_number = iban_acc.localized_BBAN1105 write_vals['acc_number_domestic'] = iban_acc.localized_BBAN
1112 new_iban = str(iban_acc)1106 write_vals['acc_number'] = str(iban_acc)
1113 elif iban != iban.upper():1107 elif bank['acc_number'] != bank['acc_number'].upper():
1114 new_iban = iban.upper1108 write_vals['acc_number'] = bank['acc_number'].upper()
1115 if iban != new_iban or new_acc_number != acc_number:1109 if write_vals:
1116 cursor.execute("UPDATE res_partner_bank "1110 partner_bank_obj.write(
1117 "SET iban = '%s', acc_number = '%s' "1111 cr, SUPERUSER_ID, bank['id'], write_vals)
1118 "WHERE id = %s" % (
1119 new_iban, new_acc_number, id
1120 ))
11211112
1122 @staticmethod1113 @staticmethod
1123 def _correct_IBAN(vals):1114 def _correct_IBAN(acc_number):
1124 '''1115 '''
1125 Routine to correct IBAN values and deduce localized values when valid.1116 Routine to correct IBAN values and deduce localized values when valid.
1126 Note: No check on validity IBAN/Country1117 Note: No check on validity IBAN/Country
1127 '''1118 '''
1128 if 'iban' in vals and vals['iban']:1119 iban = sepa.IBAN(acc_number)
1129 iban = sepa.IBAN(vals['iban'])1120 return (str(iban), iban.localized_BBAN)
1130 vals['iban'] = str(iban)
1131 vals['acc_number'] = iban.localized_BBAN
1132 return vals
11331121
1134 def create(self, cursor, uid, vals, context=None):1122 def create(self, cursor, uid, vals, context=None):
1135 '''1123 '''
1136 Create dual function IBAN account for SEPA countries1124 Create dual function IBAN account for SEPA countries
1137 '''1125 '''
1138 return self._founder.create(cursor, uid,1126 if vals['state'] == 'iban':
1139 self._correct_IBAN(vals), context1127 vals['acc_number'], vals['acc_number_domestic'] = (
1140 )1128 self._correct_IBAN(vals['acc_number']))
1129 return self._founder.create(cursor, uid, vals, context)
11411130
1142 def write(self, cursor, uid, ids, vals, context=None):1131 def write(self, cr, uid, ids, vals, context=None):
1143 '''1132 '''
1144 Create dual function IBAN account for SEPA countries1133 Create dual function IBAN account for SEPA countries
1145 '''1134 '''
1146 return self._founder.write(cursor, uid, ids,1135 if ids and isinstance(ids, (int, long)):
1147 self._correct_IBAN(vals), context1136 ids = [ids]
1148 )1137 for account in self.read(
1138 cr, uid, ids, ['state', 'acc_number']):
1139 if 'state' in vals or 'acc_number' in vals:
1140 account.update(vals)
1141 if 'state' in vals and vals['state'] == 'iban':
1142 vals['acc_number'], vals['acc_number_domestic'] = (
1143 self._correct_IBAN(account['acc_number']))
1144 else:
1145 vals['acc_number_domestic'] = False
1146 self._founder.write(cr, uid, account['id'], vals, context)
1147 return True
11491148
1150 def search(self, cursor, uid, args, *rest, **kwargs):1149 def search(self, cursor, uid, args, *rest, **kwargs):
1151 '''1150 '''
@@ -1167,7 +1166,7 @@
1167 Extend the search criteria in term when appropriate.1166 Extend the search criteria in term when appropriate.
1168 '''1167 '''
1169 extra_term = None1168 extra_term = None
1170 if term[0].lower() == 'iban' and term[1] in ('=', '=='):1169 if term[0].lower() == 'acc_number' and term[1] in ('=', '=='):
1171 iban = sepa.IBAN(term[2])1170 iban = sepa.IBAN(term[2])
1172 if iban.valid:1171 if iban.valid:
1173 # Some countries can't convert to BBAN1172 # Some countries can't convert to BBAN
@@ -1175,7 +1174,7 @@
1175 bban = iban.localized_BBAN1174 bban = iban.localized_BBAN
1176 # Prevent empty search filters1175 # Prevent empty search filters
1177 if bban:1176 if bban:
1178 extra_term = ('acc_number', term[1], bban)1177 extra_term = ('acc_number_domestic', term[1], bban)
1179 except:1178 except:
1180 pass1179 pass
1181 if extra_term:1180 if extra_term:
@@ -1212,25 +1211,33 @@
1212 )1211 )
1213 return results1212 return results
12141213
1215 def read(self, *args, **kwargs):1214 def read(
1215 self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
1216 '''1216 '''
1217 Convert IBAN electronic format to IBAN display format1217 Convert IBAN electronic format to IBAN display format
1218 SR 2012-02-19: do we really need this? Fields are converted upon write already.
1218 '''1219 '''
1219 records = self._founder.read(*args, **kwargs)1220 if fields and 'state' not in fields:
1221 fields.append('state')
1222 records = self._founder.read(cr, uid, ids, fields, context, load)
1223 is_list = True
1220 if not isinstance(records, list):1224 if not isinstance(records, list):
1221 records = [records,]1225 records = [records,]
1226 is_list = False
1222 for record in records:1227 for record in records:
1223 if 'iban' in record and record['iban']:1228 if 'acc_number' in record and record['state'] == 'iban':
1224 record['iban'] = unicode(sepa.IBAN(record['iban']))1229 record['acc_number'] = unicode(sepa.IBAN(record['acc_number']))
1225 return records1230 if is_list:
1231 return records
1232 return records[0]
12261233
1227 def check_iban(self, cursor, uid, ids):1234 def check_iban(self, cursor, uid, ids):
1228 '''1235 '''
1229 Check IBAN number1236 Check IBAN number
1230 '''1237 '''
1231 for bank_acc in self.browse(cursor, uid, ids):1238 for bank_acc in self.browse(cursor, uid, ids):
1232 if bank_acc.iban:1239 if bank_acc.state == 'iban' and bank_acc.acc_number:
1233 iban = sepa.IBAN(bank_acc.iban)1240 iban = sepa.IBAN(bank_acc.acc_number)
1234 if not iban.valid:1241 if not iban.valid:
1235 return False1242 return False
1236 return True1243 return True
@@ -1241,19 +1248,33 @@
1241 '''1248 '''
1242 res = {}1249 res = {}
1243 for record in self.browse(cursor, uid, ids, context):1250 for record in self.browse(cursor, uid, ids, context):
1244 if not record.iban:1251 if not record.state == 'iban':
1245 res[record.id] = False1252 res[record.id] = False
1246 else:1253 else:
1247 iban_acc = sepa.IBAN(record.iban)1254 iban_acc = sepa.IBAN(record.acc_number)
1248 try:1255 try:
1249 res[record.id] = iban_acc.localized_BBAN1256 res[record.id] = iban_acc.localized_BBAN
1250 except NotImplementedError:1257 except NotImplementedError:
1251 res[record.id] = False1258 res[record.id] = False
1252 return res1259 return res
12531260
1254 def onchange_acc_number(self, cursor, uid, ids, acc_number,1261 def onchange_acc_number(
1255 partner_id, country_id, context=None1262 self, cr, uid, ids, acc_number, acc_number_domestic,
1256 ):1263 state, partner_id, country_id, context=None):
1264 if state == 'iban':
1265 return self.onchange_iban(
1266 cr, uid, ids, acc_number, acc_number_domestic,
1267 state, partner_id, country_id, context=None
1268 )
1269 else:
1270 return self.onchange_domestic(
1271 cr, uid, ids, acc_number,
1272 partner_id, country_id, context=None
1273 )
1274
1275 def onchange_domestic(
1276 self, cursor, uid, ids, acc_number,
1277 partner_id, country_id, context=None):
1257 '''1278 '''
1258 Trigger to find IBAN. When found:1279 Trigger to find IBAN. When found:
1259 1. Reformat BBAN1280 1. Reformat BBAN
@@ -1314,14 +1335,18 @@
1314 )1335 )
1315 result = {'value': values}1336 result = {'value': values}
1316 # Complete data with online database when available1337 # Complete data with online database when available
1317 if partner_id and country.code in sepa.IBAN.countries:1338 if country_ids:
1339 country = country_obj.browse(
1340 cursor, uid, country_ids[0], context=context)
1341 if country and country.code in sepa.IBAN.countries:
1318 try:1342 try:
1319 info = sepa.online.account_info(country.code, acc_number)1343 info = sepa.online.account_info(country.code, acc_number)
1320 if info:1344 if info:
1321 iban_acc = sepa.IBAN(info.iban)1345 iban_acc = sepa.IBAN(info.iban)
1322 if iban_acc.valid:1346 if iban_acc.valid:
1323 values['acc_number'] = iban_acc.localized_BBAN1347 values['acc_number_domestic'] = iban_acc.localized_BBAN
1324 values['iban'] = unicode(iban_acc)1348 values['acc_number'] = unicode(iban_acc)
1349 values['state'] = 'iban'
1325 bank_id, country_id = get_or_create_bank(1350 bank_id, country_id = get_or_create_bank(
1326 self.pool, cursor, uid,1351 self.pool, cursor, uid,
1327 info.bic or iban_acc.BIC_searchkey,1352 info.bic or iban_acc.BIC_searchkey,
@@ -1355,25 +1380,27 @@
1355 values['acc_number'] = acc_number1380 values['acc_number'] = acc_number
1356 return result1381 return result
13571382
1358 def onchange_iban(self, cursor, uid, ids, iban, context=None):1383 def onchange_iban(
1384 self, cr, uid, ids, acc_number, acc_number_domestic,
1385 state, partner_id, country_id, context=None):
1359 '''1386 '''
1360 Trigger to verify IBAN. When valid:1387 Trigger to verify IBAN. When valid:
1361 1. Extract BBAN as local account1388 1. Extract BBAN as local account
1362 2. Auto complete bank1389 2. Auto complete bank
1363 '''1390 '''
1364 if not iban:1391 if not acc_number:
1365 return {}1392 return {}
13661393
1367 iban_acc = sepa.IBAN(iban)1394 iban_acc = sepa.IBAN(acc_number)
1368 if iban_acc.valid:1395 if iban_acc.valid:
1369 bank_id, country_id = get_or_create_bank(1396 bank_id, country_id = get_or_create_bank(
1370 self.pool, cursor, uid, iban_acc.BIC_searchkey,1397 self.pool, cr, uid, iban_acc.BIC_searchkey,
1371 code=iban_acc.BIC_searchkey1398 code=iban_acc.BIC_searchkey
1372 )1399 )
1373 return {1400 return {
1374 'value': dict(1401 'value': dict(
1375 acc_number = iban_acc.localized_BBAN,1402 acc_number_domestic = iban_acc.localized_BBAN,
1376 iban = unicode(iban_acc),1403 acc_number = unicode(iban_acc),
1377 country = country_id or False,1404 country = country_id or False,
1378 bank = bank_id or False,1405 bank = bank_id or False,
1379 )1406 )
@@ -1383,7 +1410,7 @@
1383 )1410 )
13841411
1385 _constraints = [1412 _constraints = [
1386 (check_iban, _("The IBAN number doesn't seem to be correct"), ["iban"])1413 (check_iban, _("The IBAN number doesn't seem to be correct"), ["acc_number"])
1387 ]1414 ]
13881415
1389res_partner_bank()1416res_partner_bank()
13901417
=== modified file 'account_banking/account_banking_view.xml'
--- account_banking/account_banking_view.xml 2012-02-17 23:36:43 +0000
+++ account_banking/account_banking_view.xml 2012-02-19 21:14:20 +0000
@@ -371,13 +371,16 @@
371 <field name="model">res.partner.bank</field>371 <field name="model">res.partner.bank</field>
372 <field name="inherit_id" ref="base.view_partner_bank_form"/>372 <field name="inherit_id" ref="base.view_partner_bank_form"/>
373 <field name="type">form</field>373 <field name="type">form</field>
374 <field name="priority" eval="24"/>
374 <field name="arch" type="xml">375 <field name="arch" type="xml">
375 <field name="acc_number" position="replace">376 <data>
376 <field name="acc_number" on_change="onchange_acc_number(acc_number, partner_id, country_id)"/>377 <field name="acc_number" position="attributes">
377 <newline />378 <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute>
378 <field name="iban" on_change="onchange_iban(iban)" />379 </field>
379 <newline />380 <field name="acc_number_domestic" position="attributes">
380 </field>381 <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute>
382 </field>
383 </data>
381 </field>384 </field>
382 </record>385 </record>
383386
@@ -397,26 +400,34 @@
397 <field name="name">res.partner.form.banking-2</field>400 <field name="name">res.partner.form.banking-2</field>
398 <field name="model">res.partner</field>401 <field name="model">res.partner</field>
399 <field name="inherit_id" ref="account.view_partner_property_form"/>402 <field name="inherit_id" ref="account.view_partner_property_form"/>
403 <field name="priority" eval="24"/>
400 <field name="type">form</field>404 <field name="type">form</field>
401 <field name="arch" type="xml">405 <field name="arch" type="xml">
402 <xpath expr="/form/notebook/page/field[@name='bank_ids']/form/field[@name='acc_number']" position="replace">406 <data>
403 <field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" />407 <field name="acc_number" position="attributes">
404 <newline />408 <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute>
405 <field name="iban" on_change="onchange_iban(iban)" />409 </field>
406 <newline />410 <field name="acc_number_domestic" position="attributes">
407 </xpath>411 <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute>
412 </field>
413 </data>
408 </field>414 </field>
409 </record>415 </record>
410 <record id="view_partner_account_banking_form_3" model="ir.ui.view">416 <record id="view_partner_account_banking_form_3" model="ir.ui.view">
411 <field name="name">res.partner.form.banking-3</field>417 <field name="name">res.partner.form.banking-3</field>
412 <field name="model">res.partner</field>418 <field name="model">res.partner</field>
413 <field name="inherit_id" ref="account.view_partner_property_form"/>419 <field name="inherit_id" ref="account.view_partner_property_form"/>
420 <field name="priority" eval="24"/>
414 <field name="type">form</field>421 <field name="type">form</field>
415 <field name="arch" type="xml">422 <field name="arch" type="xml">
416 <xpath expr="/form/notebook/page/field[@name='bank_ids']/tree/field[@name='acc_number']" position="replace">423 <data>
417 <field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" select="1" />424 <field name="acc_number" position="attributes">
418 <field name="iban" on_change="onchange_iban(iban)" />425 <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute>
419 </xpath>426 </field>
427 <field name="acc_number_domestic" position="attributes">
428 <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute>
429 </field>
430 </data>
420 </field>431 </field>
421 </record>432 </record>
422 433
423434
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py 2012-02-17 23:36:43 +0000
+++ account_banking/banking_import_transaction.py 2012-02-19 21:14:20 +0000
@@ -905,7 +905,7 @@
905 if x.communication == trans.reference 905 if x.communication == trans.reference
906 and round(x.amount, digits) == -round(trans.transferred_amount, digits)906 and round(x.amount, digits) == -round(trans.transferred_amount, digits)
907 and trans.remote_account in (x.bank_id.acc_number,907 and trans.remote_account in (x.bank_id.acc_number,
908 x.bank_id.iban)908 x.bank_id.acc_number_domestic)
909 ]909 ]
910 if len(candidates) == 1:910 if len(candidates) == 1:
911 candidate = candidates[0]911 candidate = candidates[0]
912912
=== modified file 'account_banking/data/account_banking_data.xml'
--- account_banking/data/account_banking_data.xml 2012-02-17 23:36:43 +0000
+++ account_banking/data/account_banking_data.xml 2012-02-19 21:14:20 +0000
@@ -1,24 +1,6 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
4 <!-- Re-introduce changes that were removed in 6.1 -->
5 <record id="bank_iban_field" model="res.partner.bank.type.field">
6 <field name="name">iban</field>
7 <field name="bank_type_id" ref="base_iban.bank_iban"/>
8 <field eval="True" name="required"/>
9 <field eval="False" name="readonly"/>
10 </record>
11
12 <!-- Unset readonly state of acc_number for IBAN accounts.
13 Leaving it will make it impossible to deduce BBAN's from any
14 client.
15 -->
16 <record id="bank_acc_number_field" model="res.partner.bank.type.field">
17 <field name="name">acc_number</field>
18 <field name="bank_type_id" ref="base_iban.bank_iban"/>
19 <field eval="False" name="required"/>
20 <field eval="False" name="readonly"/>
21 </record>
22 <!-- Unset readonly state of country_id for ordinary account.4 <!-- Unset readonly state of country_id for ordinary account.
23 Leaving it will make it impossible to use bank accounts with5 Leaving it will make it impossible to use bank accounts with
24 addresses outside the companies country.6 addresses outside the companies country.
257
=== modified file 'account_banking/wizard/banktools.py'
--- account_banking/wizard/banktools.py 2012-02-17 23:36:43 +0000
+++ account_banking/wizard/banktools.py 2012-02-19 21:14:20 +0000
@@ -98,8 +98,10 @@
98 ('acc_number', '=', account_number)98 ('acc_number', '=', account_number)
99 ])99 ])
100 if not bank_account_ids:100 if not bank_account_ids:
101 # SR 2012-02-19 does the search() override in res_partner_bank
102 # provides this result on the previous query?
101 bank_account_ids = partner_bank_obj.search(cursor, uid, [103 bank_account_ids = partner_bank_obj.search(cursor, uid, [
102 ('iban', '=', account_number)104 ('acc_number_domestic', '=', account_number)
103 ])105 ])
104 if not bank_account_ids:106 if not bank_account_ids:
105 if not fail:107 if not fail:
@@ -331,8 +333,8 @@
331 if iban.valid:333 if iban.valid:
332 # Take as much info as possible from IBAN334 # Take as much info as possible from IBAN
333 values.state = 'iban'335 values.state = 'iban'
334 values.iban = str(iban)336 values.acc_number = str(iban)
335 values.acc_number = iban.BBAN337 values.acc_number_domestic = iban.BBAN
336 bankcode = iban.bankcode + iban.countrycode338 bankcode = iban.bankcode + iban.countrycode
337 country_code = iban.countrycode339 country_code = iban.countrycode
338340
@@ -356,13 +358,13 @@
356 if not iban.valid:358 if not iban.valid:
357 # No, try to convert to IBAN359 # No, try to convert to IBAN
358 values.state = 'bank'360 values.state = 'bank'
359 values.acc_number = account_number361 values.acc_number = values.acc_number_domestic = account_number
360 if country_code in sepa.IBAN.countries:362 if country_code in sepa.IBAN.countries:
361 account_info = sepa.online.account_info(country_code,363 account_info = sepa.online.account_info(country_code,
362 values.acc_number364 values.acc_number
363 )365 )
364 if account_info:366 if account_info:
365 values.iban = iban = account_info.iban367 values.acc_number = iban = account_info.iban
366 values.state = 'iban'368 values.state = 'iban'
367 bankcode = account_info.code369 bankcode = account_info.code
368 bic = account_info.bic370 bic = account_info.bic
369371
=== added directory 'account_iban_preserve_domestic'
=== added file 'account_iban_preserve_domestic/__init__.py'
--- account_iban_preserve_domestic/__init__.py 1970-01-01 00:00:00 +0000
+++ account_iban_preserve_domestic/__init__.py 2012-02-19 21:14:20 +0000
@@ -0,0 +1,1 @@
1import res_partner_bank
02
=== added file 'account_iban_preserve_domestic/__openerp__.py'
--- account_iban_preserve_domestic/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_iban_preserve_domestic/__openerp__.py 2012-02-19 21:14:20 +0000
@@ -0,0 +1,61 @@
1##############################################################################
2#
3# Copyright (C) 2012 Therp BV (<http://therp.nl>).
4#
5# All other contributions are (C) by their respective contributors
6#
7# All Rights Reserved
8#
9# WARNING: This program as such is intended to be used by professional
10# programmers who take the whole responsability of assessing all potential
11# consequences resulting from its eventual inadequacies and bugs
12# End users who are looking for a ready-to-use solution with commercial
13# garantees and support are strongly adviced to contract EduSense BV
14#
15# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation, either version 3 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27#
28##############################################################################
29{
30 'name': 'Domestic bank account number',
31 'version': '0.1.108',
32 'license': 'AGPL',
33 'author': 'Therp BV',
34 'website': 'https://launchpad.net/banking-addons',
35 'category': 'Banking addons',
36 'depends': ['base_iban','account'],
37 'init_xml': [],
38 'update_xml': [
39 'res_partner_bank_view.xml'
40 ],
41 'demo_xml': [],
42 'description': '''
43This module is compatible with OpenERP 6.1.
44
45The IBAN module in OpenERP 6.1 registers the IBAN
46on the same field as the domestic account number,
47instead of keeping both on separate fields as is the
48case in 6.0.
49
50This module adds a field to register the domestic account
51number on IBANs, while the domestic account number is
52still widely in use in certain regions.
53
54Note that an upgrade to OpenERP 6.1 makes you lose the
55domestic account numbers on IBANs that were already in
56your system, unless you installed the 6.0 version of this
57module prior to the upgrade to OpenERP 6.1.
58 ''',
59 'active': False,
60 'installable': True,
61}
062
=== added file 'account_iban_preserve_domestic/res_partner_bank.py'
--- account_iban_preserve_domestic/res_partner_bank.py 1970-01-01 00:00:00 +0000
+++ account_iban_preserve_domestic/res_partner_bank.py 2012-02-19 21:14:20 +0000
@@ -0,0 +1,12 @@
1from osv import fields,osv
2class res_partner_bank(osv.osv):
3 ''' Adds a field for domestic account numbers '''
4 _inherit = "res.partner.bank"
5
6 _columns = {
7 'acc_number_domestic': fields.char(
8 'Domestic Account Number', size=64)
9 }
10
11res_partner_bank()
12
013
=== added file 'account_iban_preserve_domestic/res_partner_bank_view.xml'
--- account_iban_preserve_domestic/res_partner_bank_view.xml 1970-01-01 00:00:00 +0000
+++ account_iban_preserve_domestic/res_partner_bank_view.xml 2012-02-19 21:14:20 +0000
@@ -0,0 +1,37 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!-- add the field to the partner bank form, as defined in
6 the base module -->
7 <record id="view_partner_bank_form" model="ir.ui.view">
8 <field name="name">res.partner.bank.form</field>
9 <field name="model">res.partner.bank</field>
10 <field name="inherit_id" ref="base.view_partner_bank_form"/>
11 <field name="arch" type="xml">
12 <field name="acc_number" position="after">
13 <newline/>
14 <field name="acc_number_domestic"
15 attrs="{'invisible': [('state', '!=', 'iban')]}"
16 />
17 </field>
18 </field>
19 </record>
20
21 <!-- add the field to the partner form, as defined in
22 the account module -->
23 <record id="view_partner_account_form" model="ir.ui.view">
24 <field name="name">res.partner.account.form</field>
25 <field name="model">res.partner</field>
26 <field name="inherit_id" ref="account.view_partner_property_form"/>
27 <field name="arch" type="xml">
28 <field name="acc_number" position="after">
29 <newline/>
30 <field name="acc_number_domestic"
31 attrs="{'invisible': [('state', '!=', 'iban')]}"
32 />
33 </field>
34 </field>
35 </record>
36 </data>
37</openerp>

Subscribers

People subscribed via source and target branches