Skip to content
Extraits de code Groupes Projets
Valider d1741360 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[update] rage exo year: from 2016

parent 6155f741
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -74,14 +74,14 @@ class ScopCotisationExo(models.Model):
selection=QUARTER_SELECTION, string="Trimestre initial"
)
year_exo_start = fields.Selection(
selection=[(str(year), str(year)) for year in range(2021, 2035)],
selection=[(str(year), str(year)) for year in range(2016, 2035)],
string="Année initiale",
)
quarter_exo_end = fields.Selection(
selection=QUARTER_SELECTION, string="Trimestre final"
)
year_exo_end = fields.Selection(
selection=[(str(year), str(year)) for year in range(2021, 2035)],
selection=[(str(year), str(year)) for year in range(2016, 2035)],
string="Année finale",
)
date_exo_start = fields.Date(
......@@ -346,20 +346,21 @@ class ScopCotisationExo(models.Model):
# Unfavorable => nothing to do
if self.final_notice == "unfavorable":
self.state = "done"
elif self.year_exo_start <= "2021" and self.year_exo_end <= "2021":
self.state = "done"
# Favorable
elif self.final_notice == "favorable":
if self.year_exo_start <= "2021":
exo_start = 2022
else:
exo_start = int(self.year_exo_start)
bordereau_ids = self.env["scop.bordereau"].search(
[
("partner_id", "=", self.partner_id.id),
(
"year",
"in",
list(
range(
int(self.year_exo_start), int(self.year_exo_end) + 1
)
),
list(range(exo_start, int(self.year_exo_end) + 1)),
),
("state", "!=", "cancel"),
],
......@@ -414,7 +415,7 @@ class ScopCotisationExo(models.Model):
"""
quarters = {}
if self.year_exo_start == self.year_exo_end:
quarters[self.year_exo_start] = range(
quarters[int(self.year_exo_start)] = range(
int(self.quarter_exo_start), int(self.quarter_exo_end) + 1
)
else:
......@@ -451,7 +452,7 @@ class ScopCotisationExo(models.Model):
exo_quarters = self.get_quarters()
# check exo period
exo_period = exo_quarters[bordereau_id.year]
exo_period = exo_quarters[int(bordereau_id.year)]
# Quarter loop
for quarter in exo_period:
......
......@@ -17,10 +17,7 @@ class ScopInstance(models.Model):
all_exo_validated = fields.Boolean(
compute="_compute_all_exo_validated", default=False
)
number_exo = fields.Integer(
string="Nombre d'exo",
compute="_compute_number_exo"
)
number_exo = fields.Integer(string="Nombre d'exo", compute="_compute_number_exo")
# ------------------------------------------------------
# Computed fields / Search Fields
......
......@@ -10,7 +10,7 @@
<field name="model">scop.cotisation.cg.exo</field>
<field name="arch" type="xml">
<search string="Exonerations">
<field name="partner_id" />
<field name="partner_id" options="{'no_create': 1}" />
<field name="name" />
<field name="date_request" />
<separator />
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter