Skip to content

Commit

Permalink
Merge pull request #250 from gisce/60103_modify_get_periode_fact
Browse files Browse the repository at this point in the history
Add parameter productes_exclosos in get_periode_factura
  • Loading branch information
eberloso authored Jun 18, 2024
2 parents 3883fbb + 0e4fb3f commit 0066cc8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 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 = productes_exclosos

@property
def rangopresiondiseno(self):
Expand Down Expand Up @@ -610,8 +616,8 @@ def get_periode_factura(self):
- data fi: la mes nova de les fechasta dels conceptes
"""
return (
min([x.fecdesde for x in self.listaconceptos]),
max([x.fechasta for x in self.listaconceptos])
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 0066cc8

Please sign in to comment.