Support for global
This commit is contained in:
commit
945ce5a8b3
|
@ -103,6 +103,7 @@ class DictToCfdi():
|
|||
self._validate_data()
|
||||
self._comprobante()
|
||||
self._relacionados()
|
||||
self._global()
|
||||
self._emisor()
|
||||
self._receptor()
|
||||
self._conceptos()
|
||||
|
@ -153,6 +154,15 @@ class DictToCfdi():
|
|||
self._root = ET.Element(node_name, schema, **attr, nsmap=NSMAP)
|
||||
return
|
||||
|
||||
def _global(self):
|
||||
data = self._data.get('global', {})
|
||||
if not data:
|
||||
return
|
||||
|
||||
node_name = f'{{{self._XMLNS}}}InformacionGlobal'
|
||||
node = ET.SubElement(self._root, node_name, data)
|
||||
return
|
||||
|
||||
def _relacionados(self):
|
||||
data = self._data['relacionados']
|
||||
if not data:
|
||||
|
@ -481,6 +491,7 @@ class DataToDict():
|
|||
'04': '_receptor',
|
||||
'05': '_conceptos',
|
||||
'06': '_impuestos',
|
||||
'07': '_global',
|
||||
'10': '_leyendas',
|
||||
'11': '_complemento',
|
||||
'12': '_complemento_12',
|
||||
|
@ -679,6 +690,19 @@ class DataToDict():
|
|||
self._get_taxes(data[index + 1:])
|
||||
return
|
||||
|
||||
def _global(self, data):
|
||||
self._cfdi['global'] = {}
|
||||
fields = (
|
||||
'Periodicidad',
|
||||
'Meses',
|
||||
'Año',
|
||||
)
|
||||
for index, field in enumerate(fields):
|
||||
if not data[index]:
|
||||
continue
|
||||
self._cfdi['global'][field] = data[index]
|
||||
return
|
||||
|
||||
def _leyendas(self, data):
|
||||
if not data:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue