[FIX]l10n_be_invoice_bba error message when duplicating
lp bug: https://launchpad.net/bugs/1115472 fixed bzr revid: pl@agaplan.eu-20130205083706-sekknxzcl30ni9bn
This commit is contained in:
parent
e491b32e96
commit
489c5df814
|
@ -199,6 +199,18 @@ class account_invoice(osv.osv):
|
|||
'\nPlease create manually a unique BBA Structured Communication.'))
|
||||
return super(account_invoice, self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def copy(self, cr, uid, ids, default=None, context=None):
|
||||
default = default or {}
|
||||
invoice = self.browse(cr, uid, ids, context=context)
|
||||
reference_type = invoice.reference_type or 'none'
|
||||
default['reference_type'] = reference_type
|
||||
if reference_type == 'bba':
|
||||
partner = invoice.partner_id
|
||||
default['reference'] = self.generate_bbacomm(cr, uid, ids,
|
||||
invoice.type, reference_type,
|
||||
partner.id, '', context=context)['value']['reference']
|
||||
return super(account_invoice, self).copy(cr, uid, ids, default, context=context)
|
||||
|
||||
_columns = {
|
||||
'reference': fields.char('Communication', size=64, help="The partner reference of this invoice."),
|
||||
'reference_type': fields.selection(_get_reference_type, 'Communication Type',
|
||||
|
|
Loading…
Reference in New Issue