Carlos, we usually go with the "autocomplete" way for our clients. If they type a VAT without starting characters we just add them using an on_change method:
def onchange_vat(self, cr, uid, ids, vat):
"""
Método que comprueba el NIF/CIF y añade el prefijo ES en caso necesario
"""
if vat:
if not re.match(r'[a-zA-Z]{2}.+', vat):
vat = "ES%s" % vat.upper()
return { 'value': { 'vat': vat, 'vat_subjected': True } }
return { 'value': { 'vat_subjected': False } }
Carlos, we usually go with the "autocomplete" way for our clients. If they type a VAT without starting characters we just add them using an on_change method:
def onchange_vat(self, cr, uid, ids, vat): r'[a-zA- Z]{2}.+ ', vat):
"""
Método que comprueba el NIF/CIF y añade el prefijo ES en caso necesario
"""
if vat:
if not re.match(
vat = "ES%s" % vat.upper()
return { 'value': { 'vat': vat, 'vat_subjected': True } }
return { 'value': { 'vat_subjected': False } }