Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter productes_exclosos in get_periode_factura #250

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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])
a-orellana marked this conversation as resolved.
Show resolved Hide resolved
)

def get_periode_factura_peatges(self):
Expand Down
Loading