Skip to content
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

Ipp 11 : Correction du calcul des revenus non salariaux pour l'IR #917

Merged
merged 26 commits into from
Apr 6, 2018

Conversation

claireleroy
Copy link
Contributor

Les modifications de cette PR sont comparées à la branche ipp-update-tax-credit-aidper (#916)

  • Correction du système socio-fiscal
  • Périodes concernées : toutes
  • openfisca_france/model/prelevements_obligatoires/impot_revenu/ir.py.
  • openfisca_france/model/revenus/activite/non_salarie.py
  • openfisca_france/parameters/impot_revenu/rpns/micro/specialbnc/max.yaml
  • openfisca_france/parameters/impot_revenu/rpns/micro/specialbnc/min.yaml
  • Détails :
    • Correction de la formule des 'rpns'
    • Distinction des moins-values des revenus non salariaux "professionnels" (variable 'rpns_mvct_pro') de celles des revenus non salariaux "non professionnels" ('rpns_mvct_nonpro'), car seuls les premiers peuvent s'imputer sur le revenu global
    • Création d'une variable intermédiaire 'rpns_frag' : revenus non salariaux relevant du forfait agricole. Celui-ci disparait en 2016 et est remplacé par le régime "micro bénéfice agricole" (A FAIRE)
    • Correction du calcul de l'abattement appliqué aux revenus non commerciaux relevant du régime micro-bnc (34%) + Ajout de nouveaux paramètres associés à cet abattement
    • Modification des labels et end_date de variables de revenus non salariaux dans non_salarie.py

Ces changements :

  • Ajoutent une fonctionnalité (par exemple ajout d'une variable).
  • Corrigent ou améliorent un calcul déjà existant.
  • Impactent l'API publique d'OpenFisca France (par exemple renommage ou suppression de variables).


return frag_impo

def formula_2016_01_01(individu, period, parameters):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utiliser end plutôt que renvoyer 0

@@ -2499,7 +2555,7 @@ def abat_rpns(rev, P):

# # E revenus non commerciaux non professionnels
# regime déclaratif special ou micro-bnc
mncn_timp = abat_rpns(mncn_impo, micro.specialbnc.services) # TODO check
mncn_timp = abat_rpns(mncn_impo, micro.specialbnc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

espace en trop

RPNS = (rev_NS + rev_NS_mi + rpns_pvct + exon + abic_impm - abic_defm + alnp_imps + cncn_aimp - nbic_mvct)
exon_acc = max_(0, macc_timp + nacc_timp - macc_mvct) - macc_timp - nacc_timp # ajout artificiel
exon_ncn = max_(0, mncn_timp - mncn_mvct) - mncn_timp # ajout artificiel
RPNS = (rev_NS + rev_NS_mi + rpns_pvct + exon_acc + exon_ncn + abic_impm - abic_defm + alnp_imps + cncn_aimp - rpns_mvct_pro)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ne pas utiliser de majuscules

@@ -2329,10 +2328,10 @@ def formula(individu, period, parameters):
return frag_pvct + macc_pvct + mbic_pvct + mbnc_pvct + mncn_pvct


class rpns_mvct(Variable):
class rpns_mvct_nonpro(Variable):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-il possible de donner un nom plus explicite à cette variable ? moins_values_ct_non_pro ou moins_values_court_terme_non_pro

definition_period = YEAR

def formula(individu, period, parameters):
"""Moins values de court terme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aller à la ligne

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai viré ces descriptions finalement parce qu'elles me paraissent redondantes avec le label

@@ -2373,6 +2404,29 @@ def formula(individu, period, parameters):
return mbic_mvlt + macc_mvlt + mbnc_mvlt + mncn_mvlt


class rpns_frag(Variable):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-il possible de donner un nom plus explicite à cette variable ? rnps_revenus_forfait_agricoles ou revenus_forfait_agricoles

P.taux_wj * min_(f7wj, max1) + P.taux_wi * min_(f7wi, max2))
max1 = max_(0, max0 - f7wj) # f7wj s'impute avant f7wl et f7wi
max2 = max_(0, max1 - f7wi) # f7wi s'impute avant f7wl
return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proposition :
return (
P.taux_wr * f7wr
+ P.taux_wj * min_(f7wj, max0)
+ P.taux_wi * min_(f7wi, max1)
+ P.taux_wl * min_(f7wl, max2)
+ P.taux_wl * min_(max_(0,f7wl - max2), max00)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf. PR #916


return (P.taux_wr * f7wr + P.taux_wl * min_(f7wl, max00) + P.taux_wl * max_(f7wl - max00, 0) + P.taux_wj *
min_(f7wj, max1))
return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposition :
return (
P.taux_wr * f7wr
+ P.taux_wj * min_(f7wj, max0)
+ P.taux_wl * min_(f7wl, max1)
+ P.taux_wl * min_(max_(0,f7wl - max1), max00)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf. PR #916

@@ -707,7 +979,7 @@ class f7wv(Variable):
entity = FoyerFiscal
label = u"Dépenses en faveur de la qualité environnementale de l'habitation principale: achat de volets en 2012"
# start_date = date(2012, 1, 1)
end = '2012-12-31'
# end = '2012-12-31' changes meaning in 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf discussions sur ces expressions dans les PR précédentes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf. PR #913

# start_date = date(2013, 1, 1)
definition_period = YEAR


class fhsn(Variable):
cerfa_field = u"HSN"
# Investissements OUTRE-MER dans le secteur du logement et autres secteurs d’activité
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les cases ci-dessous n'ont pas de label. Est-il possible d'en rajouter un, même si il est très large ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf. PR #912

value_type = int
unit = 'currency'
entity = FoyerFiscal
label = u"Investissements outre-mer dans le cadre de l'entreprise : Autres investissements, Investissements dans votre entreprise avec exploitation directe, montant de la réduction d’impôt dont vous demandez l’imputation en 2013, en 2010"
# start_date = date(2013, 1, 1)
label = u"Cotisations pour la défense des forêts contre l'incendie "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

label = u"Investissements locatifs neufs dispositif Scellier : Reports concernant les investissements achevés ou acquis au cours des années antérieures, Investissements achevés en 2013 et réalisés du 1.1.2013 au 31.3.2013 avec promesse d'achat en 2012, en métropole, dans les DOM, à Saint-Barthélemy, Saint-Martin, Saint-Pierre-et-Miquelon"
# start_date = date(2014, 1, 1)
definition_period = YEAR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faut mettre 2 espaces entre les classes :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf. PR #910

2009-01-01:
value: 45000.0
2012-01-01:
value: 30000.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajouter une ligne vide à la fin :)

Claire Leroy and others added 20 commits April 6, 2018 16:25
…nnal income (rpns_mvct_nonpro) can be imputed on global income

(NB : not the case for long-run capital loss (rpns_mvlt) or for short-run net losses of non-professionnal income (rpns_mvct) that can only be imputed on similar incomes
…n 2016

TODO : code the new system of "micro BA" that replaced it
… already taken into account in 'rpns_individu'
@Anna-Livia Anna-Livia changed the base branch from ipp-update-tax-credit-aidper to master April 6, 2018 15:26
@Anna-Livia Anna-Livia dismissed their stale review April 6, 2018 15:32

Everything is fixed :)

CHANGELOG.md Outdated
* Correction du système socio-fiscal.
* Périodes concernées : toutes
* Zones impactées :
- `openfisca_france/model/prelevements_obligatoires/impot_revenu/ir`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Générallement, on omet openfisca_france/model/des chemins dans le contributing cf #956

@claireleroy claireleroy dismissed benjello’s stale review April 6, 2018 15:49

Changements déjà pris en compte

@claireleroy claireleroy merged commit 3f1bcf9 into master Apr 6, 2018
@claireleroy claireleroy deleted the ipp-update-rpns branch April 9, 2018 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants