[FIX] l10n_be_invoice_bba: add copy method to invoice to generate a new bba comunication when duplicating, courtesy of Peter Langenberg (Agaplan)
bzr revid: mat@openerp.com-20130805153713-os2c4d5bfwr0pgmk
This commit is contained in:
commit
b0619887af
|
@ -207,6 +207,19 @@ class account_invoice(osv.osv):
|
||||||
'\nPlease create manually a unique BBA Structured Communication.'))
|
'\nPlease create manually a unique BBA Structured Communication.'))
|
||||||
return super(account_invoice, self).write(cr, uid, ids, vals, context)
|
return super(account_invoice, self).write(cr, uid, ids, vals, context)
|
||||||
|
|
||||||
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
default = default or {}
|
||||||
|
invoice = self.browse(cr, uid, id, context=context)
|
||||||
|
if invoice.type in ['out_invoice']:
|
||||||
|
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, id,
|
||||||
|
invoice.type, reference_type,
|
||||||
|
partner.id, '', context=context)['value']['reference']
|
||||||
|
return super(account_invoice, self).copy(cr, uid, id, default, context=context)
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'reference': fields.char('Communication', size=64, help="The partner reference of this invoice."),
|
'reference': fields.char('Communication', size=64, help="The partner reference of this invoice."),
|
||||||
'reference_type': fields.selection(_get_reference_type, 'Communication Type',
|
'reference_type': fields.selection(_get_reference_type, 'Communication Type',
|
||||||
|
|
Loading…
Reference in New Issue