Vauxoo / cfdilib

Electronic document signature -- lib
http://cfdi.org
ISC License
5 stars 8 forks source link

NumCtaPago The value 'NA' has a length of '2' minimum length of '4' #35

Closed moylop260 closed 7 years ago

moylop260 commented 7 years ago

Using empty value from invoice for account_payment_id field empty

I saw the following error: Element '{http://www.sat.gob.mx/cfd/3}Comprobante', attribute 'NumCtaPago': [facet 'minLength'] The value 'NA' has a length of '2'; this underruns the allowed minimum length of '4'.

FYI this field is optional then we should allow a empty value here.

moylop260 commented 7 years ago

Please, consider add the tests with this case

nhomar commented 7 years ago

Where did you see this error?

nhomar commented 7 years ago

Since July that value is mandatory not optional.

moylop260 commented 7 years ago

What version of xsd are you seeing for July?

In the cfdv32.xsd searching NumCtaPago show:

You can test it in the last build of runbot for 10.0 http://runbot.vauxoo.com/runbot/56/10.0

nhomar commented 7 years ago

Según éste reporte es cómo tu indicas.

http://elconta.com/2016/07/18/cambios-metodos-de-pago-cfdi/

Yo no lo había validado por mis propios ojos.

Entiendo que todo el tema de los cuatro dígiltos es nuevo.

El error que estás mencionando lo revisaré en la librería.

luistorresm commented 7 years ago

@nhomar

No es requerido, Pero en la v9 se completaba con "0000", si venía vació, por la cuestión que no querías agregar el if para verificar que solo si viene valor en el atributo lo coloque.

Saludos

moylop260 commented 7 years ago

Para campos que no son requeridos y que vienen vacíos, no estoy seguro si es una buena idea dejar un default decidido por nosotros o eliminar el campo... 🤔

nhomar commented 7 years ago

2016-10-24 13:32 GMT-05:00 Luis Ernesto Torres Macías < notifications@github.com>:

No es requerido, Pero en la v9 https://github.com/Vauxoo/mexico/blob/9.0/oml/models/account_invoice.py#L682 se completaba con "0000", si venía vació, por la cuestión que no querías agregar el if para verificar que solo si viene valor en el atributo lo coloque.

copiado.

Nota: ¿por qué está comportandose diferentre en v10?

Nhomar Hernandez CEO Vauxoo. Site: http://vauxoo.com Twitter: @nhomar Blog: http://nhomar.com Github User: https://github.com/nhomar Odoo Gold Partner Skype: nhomar00 (Envia mail previo no lo superviso siempre). HangOut: nhomar@vauxoo.com Móvil Venezuela: +58 4144110269 Móvil México: +52 1 4773933942

luistorresm commented 7 years ago

@nhomar

Porque anteriormente se tenía un compute, y si no venía el valor se colocaba "0000"

Ahora se cambió a related, y si viene vacío en el XML coloca "NA".

Ese campo en el XSD es de len 4, entonces aquí se presenta el error.

Lo que puede ser que se agregue el if en el template de la librería, que solo cuando venga ese campo se coloque el nodo, ya que este no es requerido.

Saludos