[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
This commit is contained in:
Nicolas Martinelli 2015-03-19 10:34:22 +01:00 committed by Olivier Dony
parent 1b2c400fc1
commit aac5c47980
1 changed files with 4 additions and 7 deletions

View File

@ -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'),