[FIX] l10n_be_invoice_bba: we don't want to generate BBA communication for anything other than out_invoice

bzr revid: pl@agaplan.eu-20130731154838-pjygijihw5otkk4e
This commit is contained in:
Peter Langenberg 2013-07-31 17:48:38 +02:00
parent 489c5df814
commit 58bdae20d5
1 changed files with 8 additions and 7 deletions

View File

@ -202,13 +202,14 @@ class account_invoice(osv.osv):
def copy(self, cr, uid, ids, default=None, context=None): def copy(self, cr, uid, ids, default=None, context=None):
default = default or {} default = default or {}
invoice = self.browse(cr, uid, ids, context=context) invoice = self.browse(cr, uid, ids, context=context)
reference_type = invoice.reference_type or 'none' if invoice.type in ['out_invoice']:
default['reference_type'] = reference_type reference_type = invoice.reference_type or 'none'
if reference_type == 'bba': default['reference_type'] = reference_type
partner = invoice.partner_id if reference_type == 'bba':
default['reference'] = self.generate_bbacomm(cr, uid, ids, partner = invoice.partner_id
invoice.type, reference_type, default['reference'] = self.generate_bbacomm(cr, uid, ids,
partner.id, '', context=context)['value']['reference'] invoice.type, reference_type,
partner.id, '', context=context)['value']['reference']
return super(account_invoice, self).copy(cr, uid, ids, default, context=context) return super(account_invoice, self).copy(cr, uid, ids, default, context=context)
_columns = { _columns = {