From 083f47fcb89d59d6be83ef8ba47668cd4dfe878d Mon Sep 17 00:00:00 2001 From: "Pieter J. Kersten" Date: Mon, 15 Mar 2010 14:03:12 +0100 Subject: [PATCH] [FIX] account_banking: replaced wrong argument on on_change trigger, preventing res_partner_bank forms to open [FIX] account_banking: fixed bug in SQL code [IMP] account_banking: moved on_change triggers to base forms to silence discussions [IMP] account_banking: added dummy online converters for full SEPA countries --- account_banking/account_banking.py | 14 +++++++++----- account_banking/account_banking_view.xml | 21 ++++++++++++++++----- account_banking/sepa/online.py | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/account_banking/account_banking.py b/account_banking/account_banking.py index 7cd97d723..dcff73e29 100644 --- a/account_banking/account_banking.py +++ b/account_banking/account_banking.py @@ -832,13 +832,12 @@ class payment_order(osv.osv): def set_done(self, cr, uid, id, *args): ''' - Extend standard transition to update childs as well. + Extend standard transition to update children as well. ''' cr.execute("UPDATE payment_line " "SET export_state = 'done', date_done = '%s' " "WHERE order_id = %s" % ( - time.strftime('%Y-%m-%d'), - self.id + time.strftime('%Y-%m-%d'), id )) return super(payment_order, self).set_done( cr, uid, id, *args @@ -914,6 +913,7 @@ class res_partner_bank(osv.osv): Create dual function IBAN account for SEPA countries Note: No check on validity IBAN/Country ''' + import pdb; pdb.set_trace() if 'iban' in vals and vals['iban']: iban = sepa.IBAN(vals['iban']) vals['iban'] = str(iban) @@ -1048,12 +1048,16 @@ class res_partner_bank(osv.osv): # Pre fill country based on partners address country_obj = self.pool.get('res.country') partner_obj = self.pool.get('res.partner') - if not country_id: + if (not country_id) and partner_id: country = partner_obj.browse(cursor, uid, partner_id).country country_ids = [country.id] - else: + elif country_id: country = country_obj.browse(cursor, uid, country_id) country_ids = [country_id] + else: + # Without country, there is no way to identify the right online + # interface to get IBAN accounts... + return {} # Complete data with online database when available if country.code in sepa.IBAN.countries: diff --git a/account_banking/account_banking_view.xml b/account_banking/account_banking_view.xml index b05543ffe..5c808f62e 100644 --- a/account_banking/account_banking_view.xml +++ b/account_banking/account_banking_view.xml @@ -267,7 +267,7 @@ res.partner.bank.form.banking-2 res.partner.bank - + form @@ -291,12 +291,23 @@ res.partner.form.banking-2 res.partner - + form - - - + + + + + + + res.partner.form.banking-3 + res.partner + + form + + + + diff --git a/account_banking/sepa/online.py b/account_banking/sepa/online.py index 3153be764..724337751 100644 --- a/account_banking/sepa/online.py +++ b/account_banking/sepa/online.py @@ -102,10 +102,24 @@ def get_iban_bic_BE(bank_acc): result.code = result.bic[:6] return result +def BBAN_is_IBAN(bank_acc): + ''' + Straight copy, valid for SEPA members who switched to SEPA from old + standards before SEPA actually started. + ''' + return bank_acc + _account_info = { # TODO: Add more online data banks + 'BA': BBAN_is_IBAN, 'BE': get_iban_bic_BE, + 'BG': BBAN_is_IBAN, 'NL': get_iban_bic_NL, + 'LV': BBAN_is_IBAN, + 'LT': BBAN_is_IBAN, + 'LU': BBAN_is_IBAN, + 'MU': BBAN_is_IBAN, + 'SM': BBAN_is_IBAN, } def account_info(iso, bank_acc):