diff --git a/l10n_mx_facturae_validate_cfdi/invoice.py b/l10n_mx_facturae_validate_cfdi/invoice.py
index abeeae3a099eb6cb7269a00fe02c7a0ce09c2684..b62390fc6cefdf4a2c797f97156487f7516678c5 100644
--- a/l10n_mx_facturae_validate_cfdi/invoice.py
+++ b/l10n_mx_facturae_validate_cfdi/invoice.py
@@ -51,6 +51,9 @@ class AccountInvoice(orm.Model):
     ]
 
     def invoice_validate(self, cr, uid, ids, context=None):
+        att_obj = self.pool.get('ir.attachment')
+        partner_obj = self.pool.get('res.partner')
+        
         def validate_cfdi_folio_fiscal(data):
             """ Validate an UUID on SAT servers"""
             # Validates if "data" exists
@@ -80,14 +83,12 @@ class AccountInvoice(orm.Model):
                     _('Error'),
                     _('The CFDI provided did not passed the SAT validation\n'
                       'The UUID sate on SAT servers is %s') % result)
-
             # If CFDI is valid:
             return True
 
         # Main function
         if context is None:
             context = {}
-
         for invoice in self.browse(cr, uid, ids, context=context):
             # If the user provides the field "cfdi_folio_fiscal" then
             # validates the info of the invoice, not the xml file
@@ -107,11 +108,9 @@ class AccountInvoice(orm.Model):
                 # "validate_sat" option
                 validate_cfdi_folio_fiscal(data)
                 continue
-
             # Validates the XML info if the journal has enabled the
             # "validate_xml" option
             if invoice.journal_id.validate_xml:
-                att_obj = self.pool.get('ir.attachment')
                 att_ids = att_obj.search(
                     cr, uid,
                     [('res_id', '=', invoice.id),
@@ -120,7 +119,6 @@ class AccountInvoice(orm.Model):
                      ('file_type', '=', 'application/xml'),
                      ('file_type', '=', 'text/plain')],
                     context=context)
-
                 # Process and stores the info of the attachments
                 count = 0
                 for att in att_obj.browse(cr, uid, att_ids, context=context):
@@ -134,7 +132,6 @@ class AccountInvoice(orm.Model):
                     except:
                         # Skip file if any error
                         continue
-
                     complemento = dict_data.get('cfdi:Complemento', {})
                     emitter = dict_data.get('cfdi:Emisor', {})
                     receiver = dict_data.get('cfdi:Receptor', {})
@@ -169,6 +166,23 @@ class AccountInvoice(orm.Model):
                 if invoice.type in ['in_invoice', 'in_refund']:
                     actor = _('Receiver')
                     vat = data['vat_receiver']
+                    if invoice.partner_id.vat_split:
+                        if data['vat_emitter'] != invoice.partner_id.vat_split:
+                            raise orm.except_orm(
+                                _("Error"),
+                                _("The Supplier's vat (%s) is different " 
+                                "to the Supplier's vat " 
+                                "in the xml file (%s)"
+                                %(invoice.partner_id.vat_split, 
+                                data['vat_emitter']))
+                            )
+                    else:
+                        vat_emitter = 'MX' + data['vat_emitter']
+                        partner_obj.write(
+                        cr, uid, invoice.partner_id.id,
+                        {'vat': vat_emitter},
+                        context=context
+                    )
                 else:
                     actor = _('Emitter')
                     vat = data['vat_emitter']