forked from ScoDoc/ScoDoc
ARE: Taxe apprentissage en float
This commit is contained in:
parent
8e1cb055f6
commit
656bf4d25e
@ -36,6 +36,7 @@ from sqlalchemy import text
|
|||||||
from wtforms import (
|
from wtforms import (
|
||||||
BooleanField,
|
BooleanField,
|
||||||
DateField,
|
DateField,
|
||||||
|
DecimalField,
|
||||||
FieldList,
|
FieldList,
|
||||||
FormField,
|
FormField,
|
||||||
HiddenField,
|
HiddenField,
|
||||||
@ -125,10 +126,10 @@ class EntrepriseCreationForm(FlaskForm):
|
|||||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
if EntreprisePreferences.get_check_siret() and self.siret.data != "":
|
if EntreprisePreferences.get_check_siret() and self.siret.data != "":
|
||||||
siret_data = self.siret.data.strip().replace(" ", "")
|
siret_data = self.siret.data.strip().replace(" ", "")
|
||||||
@ -251,10 +252,10 @@ class SiteCreationForm(FlaskForm):
|
|||||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
site = EntrepriseSite.query.filter_by(
|
site = EntrepriseSite.query.filter_by(
|
||||||
entreprise_id=self.hidden_entreprise_id.data, nom=self.nom.data
|
entreprise_id=self.hidden_entreprise_id.data, nom=self.nom.data
|
||||||
@ -278,10 +279,10 @@ class SiteModificationForm(FlaskForm):
|
|||||||
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Modifier", render_kw=SUBMIT_MARGE)
|
||||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
site = EntrepriseSite.query.filter(
|
site = EntrepriseSite.query.filter(
|
||||||
EntrepriseSite.entreprise_id == self.hidden_entreprise_id.data,
|
EntrepriseSite.entreprise_id == self.hidden_entreprise_id.data,
|
||||||
@ -344,10 +345,10 @@ class OffreCreationForm(FlaskForm):
|
|||||||
(dept.id, dept.acronym) for dept in Departement.query.all()
|
(dept.id, dept.acronym) for dept in Departement.query.all()
|
||||||
]
|
]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
if len(self.depts.data) < 1:
|
if len(self.depts.data) < 1:
|
||||||
self.depts.errors.append("Choisir au moins un département")
|
self.depts.errors.append("Choisir au moins un département")
|
||||||
@ -392,10 +393,10 @@ class OffreModificationForm(FlaskForm):
|
|||||||
(dept.id, dept.acronym) for dept in Departement.query.all()
|
(dept.id, dept.acronym) for dept in Departement.query.all()
|
||||||
]
|
]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
if len(self.depts.data) < 1:
|
if len(self.depts.data) < 1:
|
||||||
self.depts.errors.append("Choisir au moins un département")
|
self.depts.errors.append("Choisir au moins un département")
|
||||||
@ -442,10 +443,10 @@ class CorrespondantCreationForm(FlaskForm):
|
|||||||
"Notes", required=False, render_kw={"class": "form-control"}
|
"Notes", required=False, render_kw={"class": "form-control"}
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
if not self.telephone.data and not self.mail.data:
|
if not self.telephone.data and not self.mail.data:
|
||||||
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
||||||
@ -461,10 +462,10 @@ class CorrespondantsCreationForm(FlaskForm):
|
|||||||
submit = SubmitField("Enregistrer")
|
submit = SubmitField("Enregistrer")
|
||||||
cancel = SubmitField("Annuler")
|
cancel = SubmitField("Annuler")
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
correspondant_list = []
|
correspondant_list = []
|
||||||
for entry in self.correspondants.entries:
|
for entry in self.correspondants.entries:
|
||||||
@ -531,10 +532,10 @@ class CorrespondantModificationForm(FlaskForm):
|
|||||||
.all()
|
.all()
|
||||||
]
|
]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
correspondant = EntrepriseCorrespondant.query.filter(
|
correspondant = EntrepriseCorrespondant.query.filter(
|
||||||
EntrepriseCorrespondant.id != self.hidden_correspondant_id.data,
|
EntrepriseCorrespondant.id != self.hidden_correspondant_id.data,
|
||||||
@ -669,12 +670,13 @@ class TaxeApprentissageForm(FlaskForm):
|
|||||||
],
|
],
|
||||||
default=int(datetime.now().strftime("%Y")),
|
default=int(datetime.now().strftime("%Y")),
|
||||||
)
|
)
|
||||||
montant = IntegerField(
|
montant = DecimalField(
|
||||||
"Montant (*)",
|
"Montant (*)",
|
||||||
validators=[
|
validators=[
|
||||||
DataRequired(message=CHAMP_REQUIS),
|
DataRequired(message=CHAMP_REQUIS),
|
||||||
NumberRange(
|
NumberRange(
|
||||||
min=1,
|
min=0.1,
|
||||||
|
max=1e8,
|
||||||
message="Le montant doit être supérieur à 0",
|
message="Le montant doit être supérieur à 0",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -684,10 +686,10 @@ class TaxeApprentissageForm(FlaskForm):
|
|||||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
taxe = EntrepriseTaxeApprentissage.query.filter_by(
|
taxe = EntrepriseTaxeApprentissage.query.filter_by(
|
||||||
entreprise_id=self.hidden_entreprise_id.data, annee=self.annee.data
|
entreprise_id=self.hidden_entreprise_id.data, annee=self.annee.data
|
||||||
@ -737,12 +739,12 @@ class EnvoiOffreForm(FlaskForm):
|
|||||||
submit = SubmitField("Envoyer")
|
submit = SubmitField("Envoyer")
|
||||||
cancel = SubmitField("Annuler")
|
cancel = SubmitField("Annuler")
|
||||||
|
|
||||||
def validate(self):
|
def validate(self, extra_validators=None):
|
||||||
validate = True
|
validate = True
|
||||||
list_select = True
|
list_select = True
|
||||||
|
|
||||||
if not FlaskForm.validate(self):
|
if not super().validate(extra_validators):
|
||||||
validate = False
|
return False
|
||||||
|
|
||||||
for entry in self.responsables.entries:
|
for entry in self.responsables.entries:
|
||||||
if entry.data:
|
if entry.data:
|
||||||
|
@ -183,7 +183,7 @@ class EntrepriseTaxeApprentissage(db.Model):
|
|||||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||||
)
|
)
|
||||||
annee = db.Column(db.Integer)
|
annee = db.Column(db.Integer)
|
||||||
montant = db.Column(db.Integer)
|
montant = db.Column(db.Float)
|
||||||
notes = db.Column(db.Text)
|
notes = db.Column(db.Text)
|
||||||
|
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ def delete_validation_entreprise(entreprise_id):
|
|||||||
text=f"Non validation de la fiche entreprise ({entreprise.nom})",
|
text=f"Non validation de la fiche entreprise ({entreprise.nom})",
|
||||||
)
|
)
|
||||||
db.session.add(log)
|
db.session.add(log)
|
||||||
flash("L'entreprise a été supprimé de la liste des entreprise à valider.")
|
flash("L'entreprise a été supprimée de la liste des entreprises à valider.")
|
||||||
return redirect(url_for("entreprises.validation"))
|
return redirect(url_for("entreprises.validation"))
|
||||||
return render_template(
|
return render_template(
|
||||||
"entreprises/form_confirmation.j2",
|
"entreprises/form_confirmation.j2",
|
||||||
@ -769,7 +769,7 @@ def delete_taxe_apprentissage(entreprise_id, taxe_id):
|
|||||||
)
|
)
|
||||||
db.session.add(log)
|
db.session.add(log)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash("La taxe d'apprentissage a été supprimé de la liste.")
|
flash("La taxe d'apprentissage a été supprimée de la liste.")
|
||||||
return redirect(
|
return redirect(
|
||||||
url_for("entreprises.fiche_entreprise", entreprise_id=taxe.entreprise_id)
|
url_for("entreprises.fiche_entreprise", entreprise_id=taxe.entreprise_id)
|
||||||
)
|
)
|
||||||
@ -965,7 +965,7 @@ def delete_offre(entreprise_id, offre_id):
|
|||||||
)
|
)
|
||||||
db.session.add(log)
|
db.session.add(log)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash("L'offre a été supprimé de la fiche entreprise.")
|
flash("L'offre a été supprimée de la fiche entreprise.")
|
||||||
return redirect(
|
return redirect(
|
||||||
url_for("entreprises.fiche_entreprise", entreprise_id=offre.entreprise_id)
|
url_for("entreprises.fiche_entreprise", entreprise_id=offre.entreprise_id)
|
||||||
)
|
)
|
||||||
|
@ -47,11 +47,28 @@ def upgrade():
|
|||||||
["id"],
|
["id"],
|
||||||
ondelete="CASCADE",
|
ondelete="CASCADE",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Les montants de taxe en float:
|
||||||
|
with op.batch_alter_table("are_taxe_apprentissage", schema=None) as batch_op:
|
||||||
|
batch_op.alter_column(
|
||||||
|
"montant",
|
||||||
|
existing_type=sa.INTEGER(),
|
||||||
|
type_=sa.Float(),
|
||||||
|
existing_nullable=True,
|
||||||
|
)
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table("are_taxe_apprentissage", schema=None) as batch_op:
|
||||||
|
batch_op.alter_column(
|
||||||
|
"montant",
|
||||||
|
existing_type=sa.Float(),
|
||||||
|
type_=sa.INTEGER(),
|
||||||
|
existing_nullable=True,
|
||||||
|
)
|
||||||
|
|
||||||
with op.batch_alter_table("are_stages_apprentissages", schema=None) as batch_op:
|
with op.batch_alter_table("are_stages_apprentissages", schema=None) as batch_op:
|
||||||
batch_op.drop_constraint(
|
batch_op.drop_constraint(
|
||||||
"are_stages_apprentissages_etudid_fkey", type_="foreignkey"
|
"are_stages_apprentissages_etudid_fkey", type_="foreignkey"
|
||||||
|
Loading…
Reference in New Issue
Block a user