facho/fe/form.py: se valida tipo de code en precio de referencia

FossilOrigin-Name: 63bb8ab5bd2d52af2113ba34c404af5120889cbca595c283c00f04a1a8c66316
This commit is contained in:
bit4bit@riseup.net 2020-06-20 14:28:50 +00:00
parent 8bfbc3fa20
commit 90cf2917d1
3 changed files with 7 additions and 2 deletions

View File

@ -70,3 +70,4 @@ TipoOrganizacion = CodeList(path_for_codelist('TipoOrganizacion-2.1.gc'), 'code'
TipoResponsabilidad = CodeList(path_for_codelist('TipoResponsabilidad-2.1.gc'), 'code', 'name')
TipoAmbiente = CodeList(path_for_codelist('TipoAmbiente-2.1.gc'), 'code', 'name')
TipoDocumento = CodeList(path_for_codelist('TipoDocumento-2.1.gc'), 'code', 'name')
CodigoPrecioReferencia = CodeList(path_for_codelist('CodigoPrecioReferencia-2.1.gc'), 'code', 'name')

View File

@ -210,7 +210,11 @@ class DianResolucion0001Validator:
self._validate_party('supplier', supplier)
def visit_invoice_line(self, line):
pass
try:
codelist.CodigoPrecioReferencia[line.price.type_code]
except KeyError:
self.errors.append(('invoice_line', 'line.price',
'not found %s' % (line.price.type_code)))
def valid(self):
return not self.errors

View File

@ -58,7 +58,7 @@ def simple_invoice():
quantity = 1,
description = 'producto facho',
item = form.StandardItem('test', 9999),
price = form.Price(100.0, '', ''),
price = form.Price(100.0, '01', ''),
tax = form.TaxTotal(
tax_amount = 0.0,
taxable_amount = 0.0,