-
Notifications
You must be signed in to change notification settings - Fork 101
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
Ajoute l'abattement d'IR de 30 ou 40% pour les résidents des DOM #1040
Conversation
60eda1a
to
dd130fe
Compare
CHANGELOG.md
Outdated
* Évolution du système socio-fiscal. | ||
* Périodes concernées : à partir du 01/01/2013. | ||
* Zones impactées : | ||
- `model\prelevements_obligatoires\impot_revenu\ir` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il me semble que les /
ne sont pas dans le bon sens ...
@@ -121,6 +122,64 @@ def formula(individu, period, parameters): | |||
return (datetime64(period.start) - date_naissance).astype('timedelta64[M]') | |||
|
|||
|
|||
class depcom_foyer(Variable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Est ce qu'on peut réutiliser les variables existantes comme https://fr.openfisca.org/legislation/residence_mayotte ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui je me suis inspiré de cette variable mais pour moi ce sont deux variables différentes :
residence_mayotte
c'est le fait d'être domicilié à Mayotte (variable ménage et mensuelle)residence_fiscale_mayotte
, c'est le fait d'avoir sa résidence fiscale à Mayotte (variable foyer fiscal et annuelle).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je comprends mieux ^^. Je pense qu'il serait interessant d'indiquer l'existence de l'autre variable dans la description, pour aider les utilisateurs.
Pour le faire fonctionner, tu peux écrire :
class depcom_foyer(Variable):
value_type = str
max_length = 5
entity = FoyerFiscal
default_value = "00000"
label = u"Code INSEE (depcom) du lieu de résidence"
definition_period = YEAR
set_input = set_input_dispatch_by_period
conditionGuadMarReu = 0 # faire une condition avec département + code commune (Depcom qui est pour l'instant une variable ménage) | ||
conditionGuyMay = 0 # provisoire | ||
conditionDOM = conditionGuadMarReu | conditionGuyMay | ||
conditionGuadMarReu = (residence_fiscale_guadeloupe | residence_fiscale_martinique | residence_fiscale_reunion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En Python, il faut privilégier le "snake case"
proposition :
residence_guad_mart_reun
ou
residence_guadeloupe_martinique_reunion
abat_dom = (conditionGuadMarReu * min_(plafond_qf.abat_dom.plaf_GuadMarReu, plafond_qf.abat_dom.taux_GuadMarReu * IP1) + | ||
conditionGuyMay * min_(plafond_qf.abat_dom.plaf_GuyMay, plafond_qf.abat_dom.taux_GuyMay * IP1)) | ||
IP2 = IP1 - abat_dom | ||
IP2 = max_(0, IP1 - abattement_dom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il y aurait-il un terme plus explicite pour IP2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui c'est vrai je propose impot_apres_abattement_dom
? Et du coup je vais modifier I0
et I1
pour que ce soit cohérent :)
conditionDOM = conditionGuadMarReu | conditionGuyMay | ||
conditionGuadMarReu = (residence_fiscale_guadeloupe | residence_fiscale_martinique | residence_fiscale_reunion) | ||
conditionGuyMay = (residence_fiscale_guyane | residence_fiscale_mayotte) | ||
conditionDOM = (conditionGuadMarReu | conditionGuyMay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Que penses-tu de residence_dom
?
|
||
return (not_(conditionDOM) * (condition62a * IP0 + condition62b * IP1) + | ||
conditionDOM * IP2) | ||
return (not_(conditionDOM) * (condition62a * IP0 + condition62b * IP1) + conditionDOM * IP2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proposition :
return (
not_(conditionDOM) * (condition62a * IP0 + condition62b * IP1)
+ conditionDOM * IP2
)
setup.py
Outdated
@@ -7,7 +7,7 @@ | |||
|
|||
setup( | |||
name = 'OpenFisca-France', | |||
version = '22.2.1', | |||
version = '22.2.2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'opterai plutot pour un bump mineur --> 22.3.0
@Anna-Livia Merci pour ta review :) ! Par ailleurs j'ai un petit problème avec les tests qui passent pas. J'ai l'impression qu'il y a un problème avec mes nouvelles variables de résidence fiscale qui sont des codes départements-communes en 5 lettres. J'utilise la fonction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, je pense avoir fixé l'issue.
Je pense que ce serait chouette d'ajouter des tests type :
- name: Résidence fiscales
period: "year:2018"
individus:
id: "parent"
foyers_fiscaux:
depcom_foyer: 97105
declarants: "parent"
output_variables:
residence_fiscale_guadeloupe: true
residence_fiscale_mayotte: false
residence_fiscale_martinique: false
residence_fiscale_guyane: false
residence_fiscale_reunion: false
Et il faudrait un autre test pour le ir_plaf_qf
en métropole, un pour la réunion et un autre pour la guyanne.
@@ -121,6 +122,64 @@ def formula(individu, period, parameters): | |||
return (datetime64(period.start) - date_naissance).astype('timedelta64[M]') | |||
|
|||
|
|||
class depcom_foyer(Variable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je comprends mieux ^^. Je pense qu'il serait interessant d'indiquer l'existence de l'autre variable dans la description, pour aider les utilisateurs.
Pour le faire fonctionner, tu peux écrire :
class depcom_foyer(Variable):
value_type = str
max_length = 5
entity = FoyerFiscal
default_value = "00000"
label = u"Code INSEE (depcom) du lieu de résidence"
definition_period = YEAR
set_input = set_input_dispatch_by_period
residence_guyane_mayotte = (residence_fiscale_guyane | residence_fiscale_mayotte) | ||
residence_dom = (residence_guadeloupe_martinique_reunion | residence_guyane_mayotte) | ||
|
||
abattement_dom = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il faut remplacer IP1
par impot_apres_reduction_complementaire
dans cette formule
@Anna-Livia Merci pour avoir trouvé l'erreur ! Au niveau des tests, tu penses qu'il faudrait les ajouter dans quel sous-dossier de |
@ClaireLeroyIPP Tu peut créer un dossier |
@Anna-Livia C'est fait ! Je rebase, change la version et c'est bon pour merger ? |
Hello @ClaireLeroyIPP On y est presque ! Pour les tests, je pense qu'il faut que tu en écrives encore pour tester (pour l'instant, il me semble que les tests se portent exclusivement sur Proposition:
|
CHANGELOG.md
Outdated
@@ -1,5 +1,15 @@ | |||
# Changelog | |||
|
|||
### 22.2.2 [#1040](https://github.com/openfisca/openfisca-france/pull/1040) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je pense que cela devrait être la version v22.3
:) tu ajoutes des fonctionnalités :)
@Anna-Livia Pour les tests sur le montant de l'impôt, je propose que ça fasse partie de la PR à venir qui rajoute des tests sur l'impôt en utilisant comme comparaison les résultats du simulateur de la DGFiP. Ces tests sont listés dans l'issue #920 sur laquelle je suis entrain de travailler d'ailleurs :) |
@ClaireLeroyIPP pour les tests, je te propose de commencer à mettre des petits tests tout simple dès maintenant. on peut même mettre dans la description des tests qu'ils sont temporaires. L'issue #920 apportera beaucoup de valeur. Cependant, elle va être massive, et j'ai peur du temps de review. Voici mon opinion. Maintenant, à toi de prendre la décision finale :) OK pour rebase et merge |
…dans les fichiers des déclarations)
…résidence fiscale "depcom_foyer"
ea41335
to
4979802
Compare
@Anna-Livia J'ai rajouté les tests du coup ! Et ça a été très utile puisque j'ai pu repérer une grossière erreur : j'avais mis taux = 40 au lieu de taux = 0.40 |
model\prelevements_obligatoires\impot_revenu\ir
.Ces changements :