Skip to content

Commit

Permalink
Merge pull request #1514 Fiabiliser l'éligibilité au livret d'épargne…
Browse files Browse the repository at this point in the history
… populaire et au logement social
  • Loading branch information
guillett authored Apr 6, 2021
2 parents 469941e + 8cca562 commit f5c1e80
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 40 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 51.14.0 [#1514](https://github.com/openfisca/openfisca-france/pull/1514)

* Évolution du système socio-fiscal.
* Périodes concernées : toutes.
* Zones impactées :
* `patrimoine/livret_epargne_populaire.py`.
* `prestations/logement_social.py`
* Détails :
- Ajoute la condition d'autonomie à l'éligibilité au livret d'épargne populaire
- Ajoute la condition de majorité au logement social

## 51.13.0 [#1513](https://github.com/openfisca/openfisca-france/pull/1513)

* Évolution du système socio-fiscal.
Expand Down
7 changes: 4 additions & 3 deletions openfisca_france/model/patrimoine/livret_epargne_populaire.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from openfisca_france.model.base import *

from openfisca_france.model.base import Individu, Variable, min_, max_, not_, MONTH
from numpy import ceil


Expand Down Expand Up @@ -31,13 +30,15 @@ class livret_epargne_populaire_eligibilite(Variable):
value_type = bool
entity = Individu
label = "Eligibilité au livret d'épargne populaire"
reference = "https://www.service-public.fr/particuliers/vosdroits/F2367"
definition_period = MONTH

def formula(individu, period, parameters):
rfr = individu.foyer_fiscal('rfr', period.n_2)
plafond = individu('livret_epargne_populaire_plafond', period)
independent = not_(individu('enfant_a_charge', period.this_year))

return rfr <= plafond
return independent * (rfr <= plafond)


class livret_epargne_populaire_taux(Variable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,18 @@ def formula(foyer_fiscal, period, parameters):
class enfant_a_charge(Variable):
value_type = bool
entity = Individu
label = "Enfant à charge non marié, de moins de 18 ans au 1er janvier de l'année de perception des" \
" revenus, ou né durant la même année, ou handicapés quel que soit son âge"
label = "Enfant à charge non marié, de moins de 18 ans non émancipé au 1er janvier de l'année de perception des revenus, ou né durant la même année, ou handicapé quel que soit son âge"
definition_period = YEAR

def formula(individu, period):
janvier = period.first_month
decembre = janvier.offset(11, 'month')
age = individu('age', janvier)

majeur = individu('majeur', janvier)
handicap = individu('handicap', decembre)
is_pac = individu.has_role(FoyerFiscal.PERSONNE_A_CHARGE)

return is_pac * ((age < 18) + handicap)
return is_pac * (not_(majeur) + handicap)


class nbF(Variable):
Expand Down
4 changes: 2 additions & 2 deletions openfisca_france/model/prestations/logement_social.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ class logement_social_eligible(Variable):
label = "Logement social - Éligibilité"

def formula_2017(famille, period, parameters):

parent_majeur = famille.any(famille.members('majeur', period), role = Famille.PARENT)
logement_social_plafond_ressources = famille('logement_social_plafond_ressources', period)
revenu_fiscal_de_reference = famille.demandeur.foyer_fiscal('rfr', period.n_2)

return revenu_fiscal_de_reference <= logement_social_plafond_ressources
return parent_majeur * (revenu_fiscal_de_reference <= logement_social_plafond_ressources)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name = "OpenFisca-France",
version = "51.13.0",
version = "51.14.0",
author = "OpenFisca Team",
author_email = "contact@openfisca.fr",
classifiers = [
Expand Down
27 changes: 8 additions & 19 deletions tests/formulas/logement_social_eligible.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
- name: Logement social - Paris et communes limitrophes - Éligible
- name: Logement social - Paris et communes limitrophes
period: 2018-01
input:
logement_social_categorie_menage: categorie_1
zone_logement_social: paris_communes_limitrophes
logement_social_categorie_menage: [categorie_1, categorie_1, categorie_1]
zone_logement_social: [paris_communes_limitrophes, paris_communes_limitrophes, paris_communes_limitrophes]
majeur: [true, false, true]
rfr:
2016: 12700
2017: 12733
2018: 12733
2016: [12700, 12700, 12735]
2017: [12700, 12700, 12700]
2018: [12700, 12700, 12700]
output:
logement_social_eligible: true

- name: Logement social - Paris et communes limitrophes - Non éligible
period: 2018-01
input:
logement_social_categorie_menage: categorie_1
zone_logement_social: paris_communes_limitrophes
rfr:
2016: 12735
2017: 12700
2018: 12700
output:
logement_social_eligible: false
logement_social_eligible: [true, false, false]
16 changes: 5 additions & 11 deletions tests/patrimoine/livret_epargne_populaire/eligibilite.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
- period: month:2019-05
input:
rfr:
2017: 9
livret_epargne_populaire_plafond: 10
2017: [9, 9, 11]
livret_epargne_populaire_plafond: [10, 10, 10]
enfant_a_charge:
2019: [true, false, false]
output:
livret_epargne_populaire_eligibilite: true

- period: month:2019-05
input:
rfr:
2017: 11
livret_epargne_populaire_plafond: 10
output:
livret_epargne_populaire_eligibilite: false
livret_epargne_populaire_eligibilite: [false, true, false]

0 comments on commit f5c1e80

Please sign in to comment.