X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fbase_iban%2Fbase_iban.py;h=f473bd090c0f9e549c951f6321f3a451c7dc5e2b;hb=bad119b71b12e04d8b0e6058978f774c86168a14;hp=b632e5f3e477cc05c18e0b45f7ff5da201ea9dcc;hpb=f13305c6557b2b2ec42f0cad7fd32a352cc07d45;p=odoo%2Fodoo.git diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index b632e5f..f473bd0 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -73,23 +73,23 @@ def _format_iban(string): class res_partner_bank(osv.osv): _inherit = "res.partner.bank" - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): #overwrite to format the iban number correctly if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) return super(res_partner_bank, self).create(cr, uid, vals, context) - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): #overwrite to format the iban number correctly if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) return super(res_partner_bank, self).write(cr, uid, ids, vals, context) - def check_iban(self, cr, uid, ids): + def check_iban(self, cr, uid, ids, context=None): ''' Check the IBAN number ''' - for bank_acc in self.browse(cr, uid, ids): + for bank_acc in self.browse(cr, uid, ids, context=context): if not bank_acc.iban: continue iban = _format_iban(bank_acc.iban).lower() @@ -109,7 +109,7 @@ class res_partner_bank(osv.osv): return False return True - def _construct_constraint_msg(self, cr, uid, ids): + def _construct_constraint_msg(self, cr, uid, ids, context=None): def default_iban_check(iban_cn): return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase @@ -117,18 +117,18 @@ class res_partner_bank(osv.osv): iban_country = self.browse(cr, uid, ids)[0].iban[:2] if default_iban_check(iban_country): iban_example = iban_country in _ref_iban and _ref_iban[iban_country] + ' \nWhere A = Account number, B = National bank code, S = Branch code, C = account No, N = branch No, K = National check digits....' or '' - return _('The IBAN does not seems to be correct. You should have entered something like this %s'), (iban_example) + return _('The IBAN does not seem to be correct. You should have entered something like this %s'), (iban_example) return _('The IBAN is invalid, It should begin with the country code'), () def name_get(self, cr, uid, ids, context=None): res = [] to_check_ids = [] - for id in self.browse(cr, uid, ids): + for id in self.browse(cr, uid, ids, context=context): if id.state=='iban': res.append((id.id,id.iban)) else: to_check_ids.append(id.id) - res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context) + res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context=context) return res def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): @@ -158,7 +158,7 @@ class res_partner_bank(osv.osv): 'ch': lambda x: x[9:], 'gb': lambda x: x[14:], } - for record in self.browse(cr, uid, ids, context): + for record in self.browse(cr, uid, ids, context=context): if not record.iban: res[record.id] = False continue