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 (
|
||||
BooleanField,
|
||||
DateField,
|
||||
DecimalField,
|
||||
FieldList,
|
||||
FormField,
|
||||
HiddenField,
|
||||
@ -125,10 +126,10 @@ class EntrepriseCreationForm(FlaskForm):
|
||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
if EntreprisePreferences.get_check_siret() and self.siret.data != "":
|
||||
siret_data = self.siret.data.strip().replace(" ", "")
|
||||
@ -251,10 +252,10 @@ class SiteCreationForm(FlaskForm):
|
||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
site = EntrepriseSite.query.filter_by(
|
||||
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)
|
||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
site = EntrepriseSite.query.filter(
|
||||
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()
|
||||
]
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
if len(self.depts.data) < 1:
|
||||
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()
|
||||
]
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
if len(self.depts.data) < 1:
|
||||
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"}
|
||||
)
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
if not self.telephone.data and not self.mail.data:
|
||||
msg = "Saisir un moyen de contact (mail ou téléphone)"
|
||||
@ -461,10 +462,10 @@ class CorrespondantsCreationForm(FlaskForm):
|
||||
submit = SubmitField("Enregistrer")
|
||||
cancel = SubmitField("Annuler")
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
correspondant_list = []
|
||||
for entry in self.correspondants.entries:
|
||||
@ -531,10 +532,10 @@ class CorrespondantModificationForm(FlaskForm):
|
||||
.all()
|
||||
]
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
correspondant = EntrepriseCorrespondant.query.filter(
|
||||
EntrepriseCorrespondant.id != self.hidden_correspondant_id.data,
|
||||
@ -669,12 +670,13 @@ class TaxeApprentissageForm(FlaskForm):
|
||||
],
|
||||
default=int(datetime.now().strftime("%Y")),
|
||||
)
|
||||
montant = IntegerField(
|
||||
montant = DecimalField(
|
||||
"Montant (*)",
|
||||
validators=[
|
||||
DataRequired(message=CHAMP_REQUIS),
|
||||
NumberRange(
|
||||
min=1,
|
||||
min=0.1,
|
||||
max=1e8,
|
||||
message="Le montant doit être supérieur à 0",
|
||||
),
|
||||
],
|
||||
@ -684,10 +686,10 @@ class TaxeApprentissageForm(FlaskForm):
|
||||
submit = SubmitField("Enregistrer", render_kw=SUBMIT_MARGE)
|
||||
cancel = SubmitField("Annuler", render_kw=SUBMIT_MARGE)
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
taxe = EntrepriseTaxeApprentissage.query.filter_by(
|
||||
entreprise_id=self.hidden_entreprise_id.data, annee=self.annee.data
|
||||
@ -737,12 +739,12 @@ class EnvoiOffreForm(FlaskForm):
|
||||
submit = SubmitField("Envoyer")
|
||||
cancel = SubmitField("Annuler")
|
||||
|
||||
def validate(self):
|
||||
def validate(self, extra_validators=None):
|
||||
validate = True
|
||||
list_select = True
|
||||
|
||||
if not FlaskForm.validate(self):
|
||||
validate = False
|
||||
if not super().validate(extra_validators):
|
||||
return False
|
||||
|
||||
for entry in self.responsables.entries:
|
||||
if entry.data:
|
||||
|
@ -183,7 +183,7 @@ class EntrepriseTaxeApprentissage(db.Model):
|
||||
db.Integer, db.ForeignKey("are_entreprises.id", ondelete="cascade")
|
||||
)
|
||||
annee = db.Column(db.Integer)
|
||||
montant = db.Column(db.Integer)
|
||||
montant = db.Column(db.Float)
|
||||
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})",
|
||||
)
|
||||
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 render_template(
|
||||
"entreprises/form_confirmation.j2",
|
||||
@ -769,7 +769,7 @@ def delete_taxe_apprentissage(entreprise_id, taxe_id):
|
||||
)
|
||||
db.session.add(log)
|
||||
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(
|
||||
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.commit()
|
||||
flash("L'offre a été supprimé de la fiche entreprise.")
|
||||
flash("L'offre a été supprimée de la fiche entreprise.")
|
||||
return redirect(
|
||||
url_for("entreprises.fiche_entreprise", entreprise_id=offre.entreprise_id)
|
||||
)
|
||||
|
@ -47,11 +47,28 @@ def upgrade():
|
||||
["id"],
|
||||
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 ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### 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:
|
||||
batch_op.drop_constraint(
|
||||
"are_stages_apprentissages_etudid_fkey", type_="foreignkey"
|
||||
|
Loading…
Reference in New Issue
Block a user