Skip to content

Commit

Permalink
Merge branch 'master' into update_defs_subtypes_r1
Browse files Browse the repository at this point in the history
  • Loading branch information
tinogis committed Dec 21, 2016
2 parents 67b2e79 + 1848f29 commit 292f8e7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
11 changes: 10 additions & 1 deletion switching/input/messages/F1.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,22 @@ def saldo_cobrament(self):
return float(self._dades_generals\
.DatosGeneralesFactura.SaldoCobro.text)

def get_create_invoice_params(self):
return {
'tipo_rectificadora': self.tipus_rectificadora,
'tipo_factura': self.tipus_factura,
'date_invoice': self.data_factura,
'check_total': abs(self.import_total_factura),
'origin': self.numero_factura,
'reference': self.numero_factura,
}

def get_linies_factura(self):
"""Retorna una llista de llistes de LiniesFactura"""
contingut = []
noms_funcio = self.mapa_linies_factura
for key in noms_funcio:
try:
test = list(getattr(self.factura, key))
if key == 'Alquileres':
data = noms_funcio[key][0]()
pobj = LiniesFactura(data, noms_funcio[key][1])
Expand Down
3 changes: 2 additions & 1 deletion switching/input/messages/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def supported(self):


class except_f1(Exception):
def __init__(self, name, value):
def __init__(self, name, value, values_dict=None):
self.name = name
self.value = value
self.values_dict = values_dict or {}
18 changes: 18 additions & 0 deletions tests/test_switching.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,24 @@ def test_facturacio_ajustes_2(self):
assert ajust['motivo'] == '99'
assert ajust['ajuste'] == res_dict[lect.magnitud][lect.periode]

def test_get_create_invoice_params(self):
expected = {
'tipo_rectificadora': 'N',
'tipo_factura': '01',
'date_invoice': '2016-01-08',
'check_total': 55.48,
'origin': '1234567890',
'reference': '1234567890'
}

f1 = F1(self.xml_ajuste)
f1.parse_xml()
aux = f1.get_factures()['FacturaATR'][0].get_create_invoice_params()
self.assertDictEqual(
aux,
expected
)

class supportClass(object):
"""Funcions de suport"""
def getHeader(self, process='C1', step='01'):
Expand Down

0 comments on commit 292f8e7

Please sign in to comment.