From 556d00bedf63979e9232105111597f90d00a5949 Mon Sep 17 00:00:00 2001 From: Marc Bellavista Date: Thu, 28 Sep 2023 11:13:16 +0200 Subject: [PATCH] fix taula provincia gas + many to many a629 --- gestionatr/defs_gas.py | 104 ++++++++++++++--------------- gestionatr/input/messages/A5_29.py | 9 +-- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/gestionatr/defs_gas.py b/gestionatr/defs_gas.py index f4b24c60..ea9e9f9c 100644 --- a/gestionatr/defs_gas.py +++ b/gestionatr/defs_gas.py @@ -331,58 +331,58 @@ ('04', 'ÚNICA'), ] TAULA_PROVINCIA = [ - ('01', 'ALAVA', '34'), - ('02', 'ALBACETE', '34'), - ('03', 'ALICANTE', '34'), - ('04', 'ALMERIA', '34'), - ('05', 'AVILA', '34'), - ('06', 'BADAJOZ', '34'), - ('07', 'BALEARES', '34'), - ('08', 'BARCELONA', '34'), - ('09', 'BURGOS', '34'), - ('10', 'CACERES', '34'), - ('11', 'CADIZ', '34'), - ('12', 'CASTELLON', '34'), - ('13', 'CIUDAD REAL', '34'), - ('14', 'CORDOBA', '34'), - ('15', 'LA CORUÑA', '34'), - ('16', 'CUENCA', '34'), - ('17', 'GERONA', '34'), - ('18', 'GRANADA', '34'), - ('19', 'GUADALAJARA', '34'), - ('20', 'GUIPUZCOA', '34'), - ('21', 'HUELVA', '34'), - ('22', 'HUESCA', '34'), - ('23', 'JAEN', '34'), - ('24', 'LEON', '34'), - ('25', 'LERIDA', '34'), - ('26', 'LA RIOJA', '34'), - ('27', 'LUGO', '34'), - ('28', 'MADRID', '34'), - ('29', 'MALAGA', '34'), - ('30', 'MURCIA', '34'), - ('31', 'NAVARRA', '34'), - ('32', 'ORENSE', '34'), - ('33', 'ASTURIAS', '34'), - ('34', 'PALENCIA', '34'), - ('35', 'LAS PALMAS', '34'), - ('36', 'PONTEVEDRA', '34'), - ('37', 'SALAMANCA', '34'), - ('38', 'SANTA CRUZ DE TENERIFE', '34'), - ('39', 'CANTABRIA', '34'), - ('40', 'SEGOVIA', '34'), - ('41', 'SEVILLA', '34'), - ('42', 'SORIA', '34'), - ('43', 'TARRAGONA', '34'), - ('44', 'TERUEL', '34'), - ('45', 'TOLEDO', '34'), - ('46', 'VALENCIA', '34'), - ('47', 'VALLADOLID', '34'), - ('48', 'VIZCAYA', '34'), - ('49', 'ZAMORA', '34'), - ('50', 'ZARAGOZA', '34'), - ('51', 'CEUTA', '34'), - ('52', 'MELILLA', '34'), + ('01', 'ALAVA'), + ('02', 'ALBACETE'), + ('03', 'ALICANTE'), + ('04', 'ALMERIA'), + ('05', 'AVILA'), + ('06', 'BADAJOZ'), + ('07', 'BALEARES'), + ('08', 'BARCELONA'), + ('09', 'BURGOS'), + ('10', 'CACERES'), + ('11', 'CADIZ'), + ('12', 'CASTELLON'), + ('13', 'CIUDAD REAL'), + ('14', 'CORDOBA'), + ('15', 'LA CORUÑA'), + ('16', 'CUENCA'), + ('17', 'GERONA'), + ('18', 'GRANADA'), + ('19', 'GUADALAJARA'), + ('20', 'GUIPUZCOA'), + ('21', 'HUELVA'), + ('22', 'HUESCA'), + ('23', 'JAEN'), + ('24', 'LEON'), + ('25', 'LERIDA'), + ('26', 'LA RIOJA'), + ('27', 'LUGO'), + ('28', 'MADRID'), + ('29', 'MALAGA'), + ('30', 'MURCIA'), + ('31', 'NAVARRA'), + ('32', 'ORENSE'), + ('33', 'ASTURIAS'), + ('34', 'PALENCIA'), + ('35', 'LAS PALMAS'), + ('36', 'PONTEVEDRA'), + ('37', 'SALAMANCA'), + ('38', 'SANTA CRUZ DE TENERIFE'), + ('39', 'CANTABRIA'), + ('40', 'SEGOVIA'), + ('41', 'SEVILLA'), + ('42', 'SORIA'), + ('43', 'TARRAGONA'), + ('44', 'TERUEL'), + ('45', 'TOLEDO'), + ('46', 'VALENCIA'), + ('47', 'VALLADOLID'), + ('48', 'VIZCAYA'), + ('49', 'ZAMORA'), + ('50', 'ZARAGOZA'), + ('51', 'CEUTA'), + ('52', 'MELILLA'), ] TAULA_NACIONALIDAD = [ ('SB', 'ISLAS SALOMON'), diff --git a/gestionatr/input/messages/A5_29.py b/gestionatr/input/messages/A5_29.py index d5feb3a8..897688f2 100644 --- a/gestionatr/input/messages/A5_29.py +++ b/gestionatr/input/messages/A5_29.py @@ -335,7 +335,8 @@ def resultimarevision(self): @property def historicoConsumo(self): data = [] - if self.datosdis.historicoConsumo not in [None, False]: + obj = get_rec_attr(self.obj, self._header, False) + if hasattr(obj, 'historicoConsumo'): for i in self.datosdis.historicoConsumo: data.append(HistoricoConsumo(i)) return data @@ -461,13 +462,13 @@ def fecactdist(self): @property def listaproductos(self): data = [] - if self.datosdis.listaproductos not in [None, False]: + obj = get_rec_attr(self.obj, self._header, False) + if (hasattr(obj, 'listaproductos') and + hasattr(obj.listaproductos, 'producto')): for i in self.datosdis.listaproductos: data.append(Producto(i)) - return data return data - class HistoricoConsumo(object): def __init__(self, data): self.historicoConsumo = data