# -*- coding: utf-8 -*-
from openerp import models, fields, api
import re


class res_partner(models.Model):
    _inherit = 'res.partner'

    formated_vat = fields.Char(
        translate=True, string='Printable VAT',
        store=True, help='Show formatted vat')

    @api.onchange('formated_vat')
    def onchange_document(self):
        mod_obj = self.env['ir.model.data']
        formated_vat = (
            re.sub('[^1234567890Kk]', '',
            str(self.formated_vat))).zfill(9).upper()

        self.vat = 'CL%s' % formated_vat
        
        self.formated_vat = formated_vat[0:2] + '.' + formated_vat[2:5] + '.' + formated_vat[5:8] +'-' + formated_vat[-1]

@@ -570,16 +570,46 @@
 ed_vat =
+ '%25s.%25s.%25s-%25s' %25 (%0A           
  formate
@@ -618,24 +618,17 @@
 vat%5B0:2%5D
- + '.' +
+,
  formate
@@ -641,16 +641,9 @@
 2:5%5D
- + '.' +
+,
  for
@@ -660,15 +660,21 @@
 5:8%5D
- +'-' +
+,%0A           
  for
@@ -686,9 +686,10 @@
 _vat%5B-1%5D
+)
 %0A

Rewrite for legibility (TravisCI)