Merge lp:~therp-nl/banking-addons/6.1-dev-preserve-domestic into lp:~banking-addons-team/banking-addons/6.1-dev
- 6.1-dev-preserve-domestic
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Jesudason (community) | Approve | ||
Review via email: mp+93746@code.launchpad.net |
Commit message
Description of the change
Adapt to changes in base_iban: preserve the domestic account number
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_banking/__openerp__.py' |
2 | --- account_banking/__openerp__.py 2012-02-01 15:36:09 +0000 |
3 | +++ account_banking/__openerp__.py 2012-02-19 21:14:20 +0000 |
4 | @@ -35,7 +35,8 @@ |
5 | 'author': 'Banking addons community', |
6 | 'website': 'https://launchpad.net/banking-addons', |
7 | 'category': 'Banking addons', |
8 | - 'depends': ['base', 'account', 'base_iban', 'account_payment'], |
9 | + 'depends': ['base', 'account', 'base_iban', 'account_payment', |
10 | + 'account_iban_preserve_domestic'], |
11 | 'init_xml': [], |
12 | 'update_xml': [ |
13 | 'security/ir.model.access.csv', |
14 | @@ -47,6 +48,9 @@ |
15 | 'workflow/account_invoice.xml', |
16 | ], |
17 | 'demo_xml': [], |
18 | + 'external_dependencies': { |
19 | + 'python' : ['BeautifulSoup'], |
20 | + }, |
21 | 'description': ''' |
22 | Module to do banking. |
23 | |
24 | |
25 | === modified file 'account_banking/account_banking.py' |
26 | --- account_banking/account_banking.py 2012-02-17 23:36:43 +0000 |
27 | +++ account_banking/account_banking.py 2012-02-19 21:14:20 +0000 |
28 | @@ -66,6 +66,7 @@ |
29 | import decimal_precision as dp |
30 | import pooler |
31 | import netsvc |
32 | +from openerp import SUPERUSER_ID |
33 | |
34 | def warning(title, message): |
35 | '''Convenience routine''' |
36 | @@ -1070,11 +1071,6 @@ |
37 | using IBAN specs. |
38 | ''' |
39 | _inherit = 'res.partner.bank' |
40 | - _columns = { |
41 | - 'iban': fields.char('IBAN', size=34, |
42 | - help="International Bank Account Number" |
43 | - ), |
44 | - } |
45 | |
46 | def __init__(self, *args, **kwargs): |
47 | ''' |
48 | @@ -1091,61 +1087,64 @@ |
49 | self._founder = mro[i] |
50 | break |
51 | |
52 | - def init(self, cursor): |
53 | + def init(self, cr): |
54 | ''' |
55 | Update existing iban accounts to comply to new regime |
56 | Note that usage of the ORM is not possible here, as the ORM cannot |
57 | search on values not provided by the client. |
58 | ''' |
59 | - cursor.execute('SELECT id, acc_number, iban ' |
60 | - 'FROM res_partner_bank ' |
61 | - 'WHERE ' |
62 | - 'upper(iban) != iban OR ' |
63 | - 'acc_number IS NULL' |
64 | - ) |
65 | - for id, acc_number, iban in cursor.fetchall(): |
66 | - new_iban = new_acc_number = False |
67 | - if iban: |
68 | - iban_acc = sepa.IBAN(iban) |
69 | + |
70 | + partner_bank_obj = self.pool.get('res.partner.bank') |
71 | + bank_ids = partner_bank_obj.search( |
72 | + cr, SUPERUSER_ID, [('state', '=', 'iban')], limit=0) |
73 | + for bank in partner_bank_obj.read(cr, SUPERUSER_ID, bank_ids): |
74 | + write_vals = {} |
75 | + if bank['state'] == 'iban': |
76 | + iban_acc = sepa.IBAN(bank['acc_number']) |
77 | if iban_acc.valid: |
78 | - new_acc_number = iban_acc.localized_BBAN |
79 | - new_iban = str(iban_acc) |
80 | - elif iban != iban.upper(): |
81 | - new_iban = iban.upper |
82 | - if iban != new_iban or new_acc_number != acc_number: |
83 | - cursor.execute("UPDATE res_partner_bank " |
84 | - "SET iban = '%s', acc_number = '%s' " |
85 | - "WHERE id = %s" % ( |
86 | - new_iban, new_acc_number, id |
87 | - )) |
88 | + write_vals['acc_number_domestic'] = iban_acc.localized_BBAN |
89 | + write_vals['acc_number'] = str(iban_acc) |
90 | + elif bank['acc_number'] != bank['acc_number'].upper(): |
91 | + write_vals['acc_number'] = bank['acc_number'].upper() |
92 | + if write_vals: |
93 | + partner_bank_obj.write( |
94 | + cr, SUPERUSER_ID, bank['id'], write_vals) |
95 | |
96 | @staticmethod |
97 | - def _correct_IBAN(vals): |
98 | + def _correct_IBAN(acc_number): |
99 | ''' |
100 | Routine to correct IBAN values and deduce localized values when valid. |
101 | Note: No check on validity IBAN/Country |
102 | ''' |
103 | - if 'iban' in vals and vals['iban']: |
104 | - iban = sepa.IBAN(vals['iban']) |
105 | - vals['iban'] = str(iban) |
106 | - vals['acc_number'] = iban.localized_BBAN |
107 | - return vals |
108 | + iban = sepa.IBAN(acc_number) |
109 | + return (str(iban), iban.localized_BBAN) |
110 | |
111 | def create(self, cursor, uid, vals, context=None): |
112 | ''' |
113 | Create dual function IBAN account for SEPA countries |
114 | ''' |
115 | - return self._founder.create(cursor, uid, |
116 | - self._correct_IBAN(vals), context |
117 | - ) |
118 | + if vals['state'] == 'iban': |
119 | + vals['acc_number'], vals['acc_number_domestic'] = ( |
120 | + self._correct_IBAN(vals['acc_number'])) |
121 | + return self._founder.create(cursor, uid, vals, context) |
122 | |
123 | - def write(self, cursor, uid, ids, vals, context=None): |
124 | + def write(self, cr, uid, ids, vals, context=None): |
125 | ''' |
126 | Create dual function IBAN account for SEPA countries |
127 | ''' |
128 | - return self._founder.write(cursor, uid, ids, |
129 | - self._correct_IBAN(vals), context |
130 | - ) |
131 | + if ids and isinstance(ids, (int, long)): |
132 | + ids = [ids] |
133 | + for account in self.read( |
134 | + cr, uid, ids, ['state', 'acc_number']): |
135 | + if 'state' in vals or 'acc_number' in vals: |
136 | + account.update(vals) |
137 | + if 'state' in vals and vals['state'] == 'iban': |
138 | + vals['acc_number'], vals['acc_number_domestic'] = ( |
139 | + self._correct_IBAN(account['acc_number'])) |
140 | + else: |
141 | + vals['acc_number_domestic'] = False |
142 | + self._founder.write(cr, uid, account['id'], vals, context) |
143 | + return True |
144 | |
145 | def search(self, cursor, uid, args, *rest, **kwargs): |
146 | ''' |
147 | @@ -1167,7 +1166,7 @@ |
148 | Extend the search criteria in term when appropriate. |
149 | ''' |
150 | extra_term = None |
151 | - if term[0].lower() == 'iban' and term[1] in ('=', '=='): |
152 | + if term[0].lower() == 'acc_number' and term[1] in ('=', '=='): |
153 | iban = sepa.IBAN(term[2]) |
154 | if iban.valid: |
155 | # Some countries can't convert to BBAN |
156 | @@ -1175,7 +1174,7 @@ |
157 | bban = iban.localized_BBAN |
158 | # Prevent empty search filters |
159 | if bban: |
160 | - extra_term = ('acc_number', term[1], bban) |
161 | + extra_term = ('acc_number_domestic', term[1], bban) |
162 | except: |
163 | pass |
164 | if extra_term: |
165 | @@ -1212,25 +1211,33 @@ |
166 | ) |
167 | return results |
168 | |
169 | - def read(self, *args, **kwargs): |
170 | + def read( |
171 | + self, cr, uid, ids, fields=None, context=None, load='_classic_read'): |
172 | ''' |
173 | Convert IBAN electronic format to IBAN display format |
174 | + SR 2012-02-19: do we really need this? Fields are converted upon write already. |
175 | ''' |
176 | - records = self._founder.read(*args, **kwargs) |
177 | + if fields and 'state' not in fields: |
178 | + fields.append('state') |
179 | + records = self._founder.read(cr, uid, ids, fields, context, load) |
180 | + is_list = True |
181 | if not isinstance(records, list): |
182 | records = [records,] |
183 | + is_list = False |
184 | for record in records: |
185 | - if 'iban' in record and record['iban']: |
186 | - record['iban'] = unicode(sepa.IBAN(record['iban'])) |
187 | - return records |
188 | + if 'acc_number' in record and record['state'] == 'iban': |
189 | + record['acc_number'] = unicode(sepa.IBAN(record['acc_number'])) |
190 | + if is_list: |
191 | + return records |
192 | + return records[0] |
193 | |
194 | def check_iban(self, cursor, uid, ids): |
195 | ''' |
196 | Check IBAN number |
197 | ''' |
198 | for bank_acc in self.browse(cursor, uid, ids): |
199 | - if bank_acc.iban: |
200 | - iban = sepa.IBAN(bank_acc.iban) |
201 | + if bank_acc.state == 'iban' and bank_acc.acc_number: |
202 | + iban = sepa.IBAN(bank_acc.acc_number) |
203 | if not iban.valid: |
204 | return False |
205 | return True |
206 | @@ -1241,19 +1248,33 @@ |
207 | ''' |
208 | res = {} |
209 | for record in self.browse(cursor, uid, ids, context): |
210 | - if not record.iban: |
211 | + if not record.state == 'iban': |
212 | res[record.id] = False |
213 | else: |
214 | - iban_acc = sepa.IBAN(record.iban) |
215 | + iban_acc = sepa.IBAN(record.acc_number) |
216 | try: |
217 | res[record.id] = iban_acc.localized_BBAN |
218 | except NotImplementedError: |
219 | res[record.id] = False |
220 | return res |
221 | |
222 | - def onchange_acc_number(self, cursor, uid, ids, acc_number, |
223 | - partner_id, country_id, context=None |
224 | - ): |
225 | + def onchange_acc_number( |
226 | + self, cr, uid, ids, acc_number, acc_number_domestic, |
227 | + state, partner_id, country_id, context=None): |
228 | + if state == 'iban': |
229 | + return self.onchange_iban( |
230 | + cr, uid, ids, acc_number, acc_number_domestic, |
231 | + state, partner_id, country_id, context=None |
232 | + ) |
233 | + else: |
234 | + return self.onchange_domestic( |
235 | + cr, uid, ids, acc_number, |
236 | + partner_id, country_id, context=None |
237 | + ) |
238 | + |
239 | + def onchange_domestic( |
240 | + self, cursor, uid, ids, acc_number, |
241 | + partner_id, country_id, context=None): |
242 | ''' |
243 | Trigger to find IBAN. When found: |
244 | 1. Reformat BBAN |
245 | @@ -1314,14 +1335,18 @@ |
246 | ) |
247 | result = {'value': values} |
248 | # Complete data with online database when available |
249 | - if partner_id and country.code in sepa.IBAN.countries: |
250 | + if country_ids: |
251 | + country = country_obj.browse( |
252 | + cursor, uid, country_ids[0], context=context) |
253 | + if country and country.code in sepa.IBAN.countries: |
254 | try: |
255 | info = sepa.online.account_info(country.code, acc_number) |
256 | if info: |
257 | iban_acc = sepa.IBAN(info.iban) |
258 | if iban_acc.valid: |
259 | - values['acc_number'] = iban_acc.localized_BBAN |
260 | - values['iban'] = unicode(iban_acc) |
261 | + values['acc_number_domestic'] = iban_acc.localized_BBAN |
262 | + values['acc_number'] = unicode(iban_acc) |
263 | + values['state'] = 'iban' |
264 | bank_id, country_id = get_or_create_bank( |
265 | self.pool, cursor, uid, |
266 | info.bic or iban_acc.BIC_searchkey, |
267 | @@ -1355,25 +1380,27 @@ |
268 | values['acc_number'] = acc_number |
269 | return result |
270 | |
271 | - def onchange_iban(self, cursor, uid, ids, iban, context=None): |
272 | + def onchange_iban( |
273 | + self, cr, uid, ids, acc_number, acc_number_domestic, |
274 | + state, partner_id, country_id, context=None): |
275 | ''' |
276 | Trigger to verify IBAN. When valid: |
277 | 1. Extract BBAN as local account |
278 | 2. Auto complete bank |
279 | ''' |
280 | - if not iban: |
281 | + if not acc_number: |
282 | return {} |
283 | |
284 | - iban_acc = sepa.IBAN(iban) |
285 | + iban_acc = sepa.IBAN(acc_number) |
286 | if iban_acc.valid: |
287 | bank_id, country_id = get_or_create_bank( |
288 | - self.pool, cursor, uid, iban_acc.BIC_searchkey, |
289 | + self.pool, cr, uid, iban_acc.BIC_searchkey, |
290 | code=iban_acc.BIC_searchkey |
291 | ) |
292 | return { |
293 | 'value': dict( |
294 | - acc_number = iban_acc.localized_BBAN, |
295 | - iban = unicode(iban_acc), |
296 | + acc_number_domestic = iban_acc.localized_BBAN, |
297 | + acc_number = unicode(iban_acc), |
298 | country = country_id or False, |
299 | bank = bank_id or False, |
300 | ) |
301 | @@ -1383,7 +1410,7 @@ |
302 | ) |
303 | |
304 | _constraints = [ |
305 | - (check_iban, _("The IBAN number doesn't seem to be correct"), ["iban"]) |
306 | + (check_iban, _("The IBAN number doesn't seem to be correct"), ["acc_number"]) |
307 | ] |
308 | |
309 | res_partner_bank() |
310 | |
311 | === modified file 'account_banking/account_banking_view.xml' |
312 | --- account_banking/account_banking_view.xml 2012-02-17 23:36:43 +0000 |
313 | +++ account_banking/account_banking_view.xml 2012-02-19 21:14:20 +0000 |
314 | @@ -371,13 +371,16 @@ |
315 | <field name="model">res.partner.bank</field> |
316 | <field name="inherit_id" ref="base.view_partner_bank_form"/> |
317 | <field name="type">form</field> |
318 | + <field name="priority" eval="24"/> |
319 | <field name="arch" type="xml"> |
320 | - <field name="acc_number" position="replace"> |
321 | - <field name="acc_number" on_change="onchange_acc_number(acc_number, partner_id, country_id)"/> |
322 | - <newline /> |
323 | - <field name="iban" on_change="onchange_iban(iban)" /> |
324 | - <newline /> |
325 | - </field> |
326 | + <data> |
327 | + <field name="acc_number" position="attributes"> |
328 | + <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute> |
329 | + </field> |
330 | + <field name="acc_number_domestic" position="attributes"> |
331 | + <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute> |
332 | + </field> |
333 | + </data> |
334 | </field> |
335 | </record> |
336 | |
337 | @@ -397,26 +400,34 @@ |
338 | <field name="name">res.partner.form.banking-2</field> |
339 | <field name="model">res.partner</field> |
340 | <field name="inherit_id" ref="account.view_partner_property_form"/> |
341 | + <field name="priority" eval="24"/> |
342 | <field name="type">form</field> |
343 | <field name="arch" type="xml"> |
344 | - <xpath expr="/form/notebook/page/field[@name='bank_ids']/form/field[@name='acc_number']" position="replace"> |
345 | - <field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" /> |
346 | - <newline /> |
347 | - <field name="iban" on_change="onchange_iban(iban)" /> |
348 | - <newline /> |
349 | - </xpath> |
350 | + <data> |
351 | + <field name="acc_number" position="attributes"> |
352 | + <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute> |
353 | + </field> |
354 | + <field name="acc_number_domestic" position="attributes"> |
355 | + <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute> |
356 | + </field> |
357 | + </data> |
358 | </field> |
359 | </record> |
360 | <record id="view_partner_account_banking_form_3" model="ir.ui.view"> |
361 | <field name="name">res.partner.form.banking-3</field> |
362 | <field name="model">res.partner</field> |
363 | <field name="inherit_id" ref="account.view_partner_property_form"/> |
364 | + <field name="priority" eval="24"/> |
365 | <field name="type">form</field> |
366 | <field name="arch" type="xml"> |
367 | - <xpath expr="/form/notebook/page/field[@name='bank_ids']/tree/field[@name='acc_number']" position="replace"> |
368 | - <field name="acc_number" on_change="onchange_acc_number(acc_number, parent.id, country_id)" select="1" /> |
369 | - <field name="iban" on_change="onchange_iban(iban)" /> |
370 | - </xpath> |
371 | + <data> |
372 | + <field name="acc_number" position="attributes"> |
373 | + <attribute name="on_change">onchange_acc_number(acc_number, acc_number_domestic, state, partner_id, country_id)</attribute> |
374 | + </field> |
375 | + <field name="acc_number_domestic" position="attributes"> |
376 | + <attribute name="on_change">onchange_domestic(acc_number_domestic, partner_id, country_id)</attribute> |
377 | + </field> |
378 | + </data> |
379 | </field> |
380 | </record> |
381 | |
382 | |
383 | === modified file 'account_banking/banking_import_transaction.py' |
384 | --- account_banking/banking_import_transaction.py 2012-02-17 23:36:43 +0000 |
385 | +++ account_banking/banking_import_transaction.py 2012-02-19 21:14:20 +0000 |
386 | @@ -905,7 +905,7 @@ |
387 | if x.communication == trans.reference |
388 | and round(x.amount, digits) == -round(trans.transferred_amount, digits) |
389 | and trans.remote_account in (x.bank_id.acc_number, |
390 | - x.bank_id.iban) |
391 | + x.bank_id.acc_number_domestic) |
392 | ] |
393 | if len(candidates) == 1: |
394 | candidate = candidates[0] |
395 | |
396 | === modified file 'account_banking/data/account_banking_data.xml' |
397 | --- account_banking/data/account_banking_data.xml 2012-02-17 23:36:43 +0000 |
398 | +++ account_banking/data/account_banking_data.xml 2012-02-19 21:14:20 +0000 |
399 | @@ -1,24 +1,6 @@ |
400 | <?xml version="1.0" encoding="utf-8"?> |
401 | <openerp> |
402 | <data> |
403 | - <!-- Re-introduce changes that were removed in 6.1 --> |
404 | - <record id="bank_iban_field" model="res.partner.bank.type.field"> |
405 | - <field name="name">iban</field> |
406 | - <field name="bank_type_id" ref="base_iban.bank_iban"/> |
407 | - <field eval="True" name="required"/> |
408 | - <field eval="False" name="readonly"/> |
409 | - </record> |
410 | - |
411 | - <!-- Unset readonly state of acc_number for IBAN accounts. |
412 | - Leaving it will make it impossible to deduce BBAN's from any |
413 | - client. |
414 | - --> |
415 | - <record id="bank_acc_number_field" model="res.partner.bank.type.field"> |
416 | - <field name="name">acc_number</field> |
417 | - <field name="bank_type_id" ref="base_iban.bank_iban"/> |
418 | - <field eval="False" name="required"/> |
419 | - <field eval="False" name="readonly"/> |
420 | - </record> |
421 | <!-- Unset readonly state of country_id for ordinary account. |
422 | Leaving it will make it impossible to use bank accounts with |
423 | addresses outside the companies country. |
424 | |
425 | === modified file 'account_banking/wizard/banktools.py' |
426 | --- account_banking/wizard/banktools.py 2012-02-17 23:36:43 +0000 |
427 | +++ account_banking/wizard/banktools.py 2012-02-19 21:14:20 +0000 |
428 | @@ -98,8 +98,10 @@ |
429 | ('acc_number', '=', account_number) |
430 | ]) |
431 | if not bank_account_ids: |
432 | + # SR 2012-02-19 does the search() override in res_partner_bank |
433 | + # provides this result on the previous query? |
434 | bank_account_ids = partner_bank_obj.search(cursor, uid, [ |
435 | - ('iban', '=', account_number) |
436 | + ('acc_number_domestic', '=', account_number) |
437 | ]) |
438 | if not bank_account_ids: |
439 | if not fail: |
440 | @@ -331,8 +333,8 @@ |
441 | if iban.valid: |
442 | # Take as much info as possible from IBAN |
443 | values.state = 'iban' |
444 | - values.iban = str(iban) |
445 | - values.acc_number = iban.BBAN |
446 | + values.acc_number = str(iban) |
447 | + values.acc_number_domestic = iban.BBAN |
448 | bankcode = iban.bankcode + iban.countrycode |
449 | country_code = iban.countrycode |
450 | |
451 | @@ -356,13 +358,13 @@ |
452 | if not iban.valid: |
453 | # No, try to convert to IBAN |
454 | values.state = 'bank' |
455 | - values.acc_number = account_number |
456 | + values.acc_number = values.acc_number_domestic = account_number |
457 | if country_code in sepa.IBAN.countries: |
458 | account_info = sepa.online.account_info(country_code, |
459 | values.acc_number |
460 | ) |
461 | if account_info: |
462 | - values.iban = iban = account_info.iban |
463 | + values.acc_number = iban = account_info.iban |
464 | values.state = 'iban' |
465 | bankcode = account_info.code |
466 | bic = account_info.bic |
467 | |
468 | === added directory 'account_iban_preserve_domestic' |
469 | === added file 'account_iban_preserve_domestic/__init__.py' |
470 | --- account_iban_preserve_domestic/__init__.py 1970-01-01 00:00:00 +0000 |
471 | +++ account_iban_preserve_domestic/__init__.py 2012-02-19 21:14:20 +0000 |
472 | @@ -0,0 +1,1 @@ |
473 | +import res_partner_bank |
474 | |
475 | === added file 'account_iban_preserve_domestic/__openerp__.py' |
476 | --- account_iban_preserve_domestic/__openerp__.py 1970-01-01 00:00:00 +0000 |
477 | +++ account_iban_preserve_domestic/__openerp__.py 2012-02-19 21:14:20 +0000 |
478 | @@ -0,0 +1,61 @@ |
479 | +############################################################################## |
480 | +# |
481 | +# Copyright (C) 2012 Therp BV (<http://therp.nl>). |
482 | +# |
483 | +# All other contributions are (C) by their respective contributors |
484 | +# |
485 | +# All Rights Reserved |
486 | +# |
487 | +# WARNING: This program as such is intended to be used by professional |
488 | +# programmers who take the whole responsability of assessing all potential |
489 | +# consequences resulting from its eventual inadequacies and bugs |
490 | +# End users who are looking for a ready-to-use solution with commercial |
491 | +# garantees and support are strongly adviced to contract EduSense BV |
492 | +# |
493 | +# This program is free software: you can redistribute it and/or modify |
494 | +# it under the terms of the GNU General Public License as published by |
495 | +# the Free Software Foundation, either version 3 of the License, or |
496 | +# (at your option) any later version. |
497 | +# |
498 | +# This program is distributed in the hope that it will be useful, |
499 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
500 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
501 | +# GNU General Public License for more details. |
502 | +# |
503 | +# You should have received a copy of the GNU General Public License |
504 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
505 | +# |
506 | +############################################################################## |
507 | +{ |
508 | + 'name': 'Domestic bank account number', |
509 | + 'version': '0.1.108', |
510 | + 'license': 'AGPL', |
511 | + 'author': 'Therp BV', |
512 | + 'website': 'https://launchpad.net/banking-addons', |
513 | + 'category': 'Banking addons', |
514 | + 'depends': ['base_iban','account'], |
515 | + 'init_xml': [], |
516 | + 'update_xml': [ |
517 | + 'res_partner_bank_view.xml' |
518 | + ], |
519 | + 'demo_xml': [], |
520 | + 'description': ''' |
521 | +This module is compatible with OpenERP 6.1. |
522 | + |
523 | +The IBAN module in OpenERP 6.1 registers the IBAN |
524 | +on the same field as the domestic account number, |
525 | +instead of keeping both on separate fields as is the |
526 | +case in 6.0. |
527 | + |
528 | +This module adds a field to register the domestic account |
529 | +number on IBANs, while the domestic account number is |
530 | +still widely in use in certain regions. |
531 | + |
532 | +Note that an upgrade to OpenERP 6.1 makes you lose the |
533 | +domestic account numbers on IBANs that were already in |
534 | +your system, unless you installed the 6.0 version of this |
535 | +module prior to the upgrade to OpenERP 6.1. |
536 | + ''', |
537 | + 'active': False, |
538 | + 'installable': True, |
539 | +} |
540 | |
541 | === added file 'account_iban_preserve_domestic/res_partner_bank.py' |
542 | --- account_iban_preserve_domestic/res_partner_bank.py 1970-01-01 00:00:00 +0000 |
543 | +++ account_iban_preserve_domestic/res_partner_bank.py 2012-02-19 21:14:20 +0000 |
544 | @@ -0,0 +1,12 @@ |
545 | +from osv import fields,osv |
546 | +class res_partner_bank(osv.osv): |
547 | + ''' Adds a field for domestic account numbers ''' |
548 | + _inherit = "res.partner.bank" |
549 | + |
550 | + _columns = { |
551 | + 'acc_number_domestic': fields.char( |
552 | + 'Domestic Account Number', size=64) |
553 | + } |
554 | + |
555 | +res_partner_bank() |
556 | + |
557 | |
558 | === added file 'account_iban_preserve_domestic/res_partner_bank_view.xml' |
559 | --- account_iban_preserve_domestic/res_partner_bank_view.xml 1970-01-01 00:00:00 +0000 |
560 | +++ account_iban_preserve_domestic/res_partner_bank_view.xml 2012-02-19 21:14:20 +0000 |
561 | @@ -0,0 +1,37 @@ |
562 | +<?xml version="1.0" encoding="utf-8"?> |
563 | +<openerp> |
564 | + <data> |
565 | + |
566 | + <!-- add the field to the partner bank form, as defined in |
567 | + the base module --> |
568 | + <record id="view_partner_bank_form" model="ir.ui.view"> |
569 | + <field name="name">res.partner.bank.form</field> |
570 | + <field name="model">res.partner.bank</field> |
571 | + <field name="inherit_id" ref="base.view_partner_bank_form"/> |
572 | + <field name="arch" type="xml"> |
573 | + <field name="acc_number" position="after"> |
574 | + <newline/> |
575 | + <field name="acc_number_domestic" |
576 | + attrs="{'invisible': [('state', '!=', 'iban')]}" |
577 | + /> |
578 | + </field> |
579 | + </field> |
580 | + </record> |
581 | + |
582 | + <!-- add the field to the partner form, as defined in |
583 | + the account module --> |
584 | + <record id="view_partner_account_form" model="ir.ui.view"> |
585 | + <field name="name">res.partner.account.form</field> |
586 | + <field name="model">res.partner</field> |
587 | + <field name="inherit_id" ref="account.view_partner_property_form"/> |
588 | + <field name="arch" type="xml"> |
589 | + <field name="acc_number" position="after"> |
590 | + <newline/> |
591 | + <field name="acc_number_domestic" |
592 | + attrs="{'invisible': [('state', '!=', 'iban')]}" |
593 | + /> |
594 | + </field> |
595 | + </field> |
596 | + </record> |
597 | + </data> |
598 | +</openerp> |
The license for preserve domestic module needs to be 'AGPL-3' (not AGPL), otherwise this looks fine.