From aac5c4798018e17fcd2d21cc56be381a1cd219b6 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 19 Mar 2015 10:34:22 +0100 Subject: [PATCH] [FIX] l10n_be_invoice_bba: only check BBA when modified The BBA communication is now only checked when provided as input (created or modified). Avoids useless check for uniqueness when it's not modified, and prevent errors when several invoices are modified in batch. opw: 629649 Closes #5700 --- addons/l10n_be_invoice_bba/invoice.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/addons/l10n_be_invoice_bba/invoice.py b/addons/l10n_be_invoice_bba/invoice.py index 499e6e6c4ac..de28a544ecd 100644 --- a/addons/l10n_be_invoice_bba/invoice.py +++ b/addons/l10n_be_invoice_bba/invoice.py @@ -190,13 +190,10 @@ class account_invoice(osv.osv): reference_type = vals['reference_type'] else: reference_type = inv.reference_type or '' - if reference_type == 'bba': - if vals.has_key('reference'): - bbacomm = vals['reference'] - else: - bbacomm = inv.reference or '' - if self.check_bbacomm(bbacomm): - reference = re.sub('\D', '', bbacomm) + + if reference_type == 'bba' and 'reference' in vals: + if self.check_bbacomm(vals['reference']): + reference = re.sub('\D', '', vals['reference']) vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++' same_ids = self.search(cr, uid, [('id', '!=', inv.id), ('type', '=', 'out_invoice'),