Skip to content

Commit

Permalink
Add productes_exclosos in B7031
Browse files Browse the repository at this point in the history
  • Loading branch information
a-orellana committed Jun 17, 2024
1 parent 62c3334 commit bcc857b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions gestionatr/input/messages/B70.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@


class B7031(MessageGas):
def __init__(self, xml, force_tipus=None, productes_exclosos=None):
if productes_exclosos is None:
productes_exclosos = []
super(MessageGas, self).__init__(xml, force_tipus=force_tipus)
self.productes_exclosos = productes_exclosos

@property
def datosempresaemisora(self):
Expand All @@ -30,7 +35,7 @@ def datosempresadestino(self):
def facturas(self):
data = []
for d in get_rec_attr(self.obj, 'factura', []):
data.append(Factura(d))
data.append(Factura(d, self.productes_exclosos))
return data

def get_datosempresaemisora(self):
Expand Down Expand Up @@ -125,8 +130,9 @@ def regmercantil(self):


class Factura(object):
def __init__(self, data):
def __init__(self, data, productes_exclosos):
self.obj = data
self.productes_exclosos

@property
def rangopresiondiseno(self):
Expand Down Expand Up @@ -604,16 +610,14 @@ def codtbai(self):
else:
return False

def get_periode_factura(self, productes_exclosos=None):
def get_periode_factura(self):
"""Retorna tupla amb (data inici, data fi) de la factura:
- data inici: la mes antiga de les fecdesde dels conceptes
- data fi: la mes nova de les fechasta dels conceptes
"""
if productes_exclosos is None:
productes_exclosos = []
return (
min([x.fecdesde for x in self.listaconceptos if x.codconcepto not in productes_exclosos]),
max([x.fechasta for x in self.listaconceptos if x.codconcepto not in productes_exclosos])
min([x.fecdesde for x in self.listaconceptos if x.codconcepto not in self.productes_exclosos]),
max([x.fechasta for x in self.listaconceptos if x.codconcepto not in self.productes_exclosos])
)

def get_periode_factura_peatges(self):
Expand Down

0 comments on commit bcc857b

Please sign in to comment.