Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
F
financial_contract_guarantee
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
financial_tools
financial_contract_guarantee
Validations
4f8db418
Valider
4f8db418
rédigé
Il y a 1 mois
par
Hugo Trentesaux
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refac final risk guarantee
parent
5b474b6d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/financial_contract_guarantee.py
+37
-16
37 ajouts, 16 suppressions
models/financial_contract_guarantee.py
avec
37 ajouts
et
16 suppressions
models/financial_contract_guarantee.py
+
37
−
16
Voir le fichier @
4f8db418
...
@@ -71,6 +71,7 @@ class FinancialContractGuarantee(models.Model):
...
@@ -71,6 +71,7 @@ class FinancialContractGuarantee(models.Model):
string
=
"
En cours de garantie
"
,
string
=
"
En cours de garantie
"
,
store
=
True
,
store
=
True
,
tracking
=
1
,
tracking
=
1
,
help
=
"
Calculé comme le produit du CRDU par la quotité garantie.
"
,
)
)
is_counter_guarantee
=
fields
.
Boolean
(
"
Contre Garantie
"
,
default
=
False
)
is_counter_guarantee
=
fields
.
Boolean
(
"
Contre Garantie
"
,
default
=
False
)
counter_guarantee_rate
=
fields
.
Float
(
"
Quotité contre garantie
"
)
counter_guarantee_rate
=
fields
.
Float
(
"
Quotité contre garantie
"
)
...
@@ -82,6 +83,9 @@ class FinancialContractGuarantee(models.Model):
...
@@ -82,6 +83,9 @@ class FinancialContractGuarantee(models.Model):
compute
=
"
_compute_final_risk_guarantee
"
,
compute
=
"
_compute_final_risk_guarantee
"
,
store
=
True
,
store
=
True
,
tracking
=
1
,
tracking
=
1
,
help
=
"
Le risque final est l
'
encours de garantie moins les FMG
"
"
et les parts sociales. Dans le cas d
'
une co-garantie,
"
"
on retire également son montant.
"
,
)
)
# --- FMG ---
# --- FMG ---
...
@@ -89,11 +93,13 @@ class FinancialContractGuarantee(models.Model):
...
@@ -89,11 +93,13 @@ class FinancialContractGuarantee(models.Model):
string
=
"
FMG calculé
"
,
string
=
"
FMG calculé
"
,
compute
=
"
_compute_fmg_amount
"
,
compute
=
"
_compute_fmg_amount
"
,
store
=
True
,
store
=
True
,
help
=
"
Calculé à partir du montant garanti initial et du taux de FMG.
"
,
)
)
fmg_paid
=
fields
.
Monetary
(
fmg_paid
=
fields
.
Monetary
(
string
=
"
FMG payé
"
,
string
=
"
FMG payé
"
,
compute
=
"
_compute_fmg_paid
"
,
compute
=
"
_compute_fmg_paid
"
,
store
=
True
,
store
=
True
,
help
=
"
Calculé sur la somme des lignes de FMG.
"
,
)
)
fmg_ids
=
fields
.
One2many
(
fmg_ids
=
fields
.
One2many
(
comodel_name
=
"
mutual.guarantee.fund.line
"
,
comodel_name
=
"
mutual.guarantee.fund.line
"
,
...
@@ -103,7 +109,11 @@ class FinancialContractGuarantee(models.Model):
...
@@ -103,7 +109,11 @@ class FinancialContractGuarantee(models.Model):
# --- Social share ---
# --- Social share ---
social_share_number
=
fields
.
Integer
(
social_share_number
=
fields
.
Integer
(
string
=
"
Nbre parts sociales
"
,
compute
=
"
_compute_social_share_number
"
,
store
=
True
string
=
"
Nbre parts sociales
"
,
compute
=
"
_compute_social_share_number
"
,
store
=
True
,
help
=
"
Nombre de parts sociales calculé à partir
"
"
du montant total et du prix unitaire.
"
,
)
)
social_share_amount
=
fields
.
Monetary
(
social_share_amount
=
fields
.
Monetary
(
string
=
"
Montant parts sociales décidé
"
,
string
=
"
Montant parts sociales décidé
"
,
...
@@ -112,6 +122,8 @@ class FinancialContractGuarantee(models.Model):
...
@@ -112,6 +122,8 @@ class FinancialContractGuarantee(models.Model):
string
=
"
Montant parts sociales calculé
"
,
string
=
"
Montant parts sociales calculé
"
,
compute
=
"
_compute_social_share
"
,
compute
=
"
_compute_social_share
"
,
store
=
True
,
store
=
True
,
help
=
"
Montant des parts sociales calculé à partir du taux
"
"
et de la quantité maximale de parts sociales.
"
,
)
)
social_share_ids
=
fields
.
One2many
(
social_share_ids
=
fields
.
One2many
(
comodel_name
=
"
company.share.line
"
,
comodel_name
=
"
company.share.line
"
,
...
@@ -122,6 +134,7 @@ class FinancialContractGuarantee(models.Model):
...
@@ -122,6 +134,7 @@ class FinancialContractGuarantee(models.Model):
string
=
"
Montant parts sociales payé
"
,
string
=
"
Montant parts sociales payé
"
,
compute
=
"
_compute_social_share_paid
"
,
compute
=
"
_compute_social_share_paid
"
,
store
=
True
,
store
=
True
,
help
=
"
Montant calculé sur la somme des lignes de mouvements de parts sociales.
"
,
)
)
# --- Commission ---
# --- Commission ---
...
@@ -158,6 +171,7 @@ class FinancialContractGuarantee(models.Model):
...
@@ -158,6 +171,7 @@ class FinancialContractGuarantee(models.Model):
compute
=
"
_compute_amount_initial
"
,
compute
=
"
_compute_amount_initial
"
,
store
=
True
,
store
=
True
,
readonly
=
False
,
readonly
=
False
,
help
=
"
Montant du prêt.
"
)
)
amount_received
=
fields
.
Monetary
(
"
Montant reçu
"
)
amount_received
=
fields
.
Monetary
(
"
Montant reçu
"
)
expiration_date_computed
=
fields
.
Date
(
expiration_date_computed
=
fields
.
Date
(
...
@@ -217,23 +231,21 @@ class FinancialContractGuarantee(models.Model):
...
@@ -217,23 +231,21 @@ class FinancialContractGuarantee(models.Model):
commission_ids_count
=
fields
.
Integer
(
commission_ids_count
=
fields
.
Integer
(
compute
=
"
_compute_commission_ids_count
"
,
store
=
True
compute
=
"
_compute_commission_ids_count
"
,
store
=
True
)
)
@api.depends
(
"
commission_ids
"
)
@api.depends
(
"
commission_ids
"
)
def
_compute_commission_ids_count
(
self
):
def
_compute_commission_ids_count
(
self
):
for
g
in
self
:
for
g
in
self
:
g
.
commission_ids_count
=
len
(
g
.
commission_ids
)
g
.
commission_ids_count
=
len
(
g
.
commission_ids
)
line_ids_count
=
fields
.
Integer
(
compute
=
"
_compute_line_ids_count
"
,
store
=
True
)
line_ids_count
=
fields
.
Integer
(
compute
=
"
_compute_line_ids_count
"
,
store
=
True
)
@api.depends
(
"
line_ids
"
)
@api.depends
(
"
line_ids
"
)
def
_compute_line_ids_count
(
self
):
def
_compute_line_ids_count
(
self
):
for
g
in
self
:
for
g
in
self
:
g
.
line_ids_count
=
len
(
g
.
line_ids
)
g
.
line_ids_count
=
len
(
g
.
line_ids
)
fmg_ids_count
=
fields
.
Integer
(
fmg_ids_count
=
fields
.
Integer
(
compute
=
"
_compute_fmg_ids_count
"
,
store
=
True
)
compute
=
"
_compute_fmg_ids_count
"
,
store
=
True
)
@api.depends
(
"
fmg_ids
"
)
@api.depends
(
"
fmg_ids
"
)
def
_compute_fmg_ids_count
(
self
):
def
_compute_fmg_ids_count
(
self
):
for
g
in
self
:
for
g
in
self
:
...
@@ -242,6 +254,7 @@ class FinancialContractGuarantee(models.Model):
...
@@ -242,6 +254,7 @@ class FinancialContractGuarantee(models.Model):
social_share_ids_count
=
fields
.
Integer
(
social_share_ids_count
=
fields
.
Integer
(
compute
=
"
_compute_social_share_ids_count
"
,
store
=
True
compute
=
"
_compute_social_share_ids_count
"
,
store
=
True
)
)
@api.depends
(
"
social_share_ids
"
)
@api.depends
(
"
social_share_ids
"
)
def
_compute_social_share_ids_count
(
self
):
def
_compute_social_share_ids_count
(
self
):
for
g
in
self
:
for
g
in
self
:
...
@@ -302,16 +315,24 @@ class FinancialContractGuarantee(models.Model):
...
@@ -302,16 +315,24 @@ class FinancialContractGuarantee(models.Model):
@api.depends
(
"
guarantee_amount
"
,
"
is_counter_guarantee
"
,
"
counter_guarantee_rate
"
)
@api.depends
(
"
guarantee_amount
"
,
"
is_counter_guarantee
"
,
"
counter_guarantee_rate
"
)
def
_compute_final_risk_guarantee
(
self
):
def
_compute_final_risk_guarantee
(
self
):
"""
encours garanti - FMG - PS
si contre garantie, on retire également son montant
"""
for
guarantee
in
self
:
for
guarantee
in
self
:
if
not
guarantee
.
is_counter_guarantee
:
# FIXME doit-on vraiment retrancher le montant des parts sociales ?
guarantee
.
final_risk_guarantee
=
guarantee
.
guarantee_amount
frg
=
(
else
:
guarantee
.
guarantee_amount
guarantee
.
final_risk_guarantee
=
(
-
guarantee
.
fmg_amount
1
-
guarantee
.
counter_guarantee_rate
-
guarantee
.
social_share_amount
)
*
guarantee
.
guarantee_amount
)
# la contre garantie diminue d'autant le risque final
if
guarantee
.
is_counter_guarantee
:
frg
*=
1
-
guarantee
.
counter_guarantee_rate
guarantee
.
final_risk_guarantee
=
frg
@api.depends
(
"
remaining_capital
"
,
"
guarantee_rate
"
)
@api.depends
(
"
remaining_capital
"
,
"
guarantee_rate
"
)
def
_compute_guarantee_amount
(
self
):
def
_compute_guarantee_amount
(
self
):
"
CRDU × quotité
"
for
guarantee
in
self
:
for
guarantee
in
self
:
guarantee
.
guarantee_amount
=
(
guarantee
.
guarantee_amount
=
(
guarantee
.
remaining_capital
*
guarantee
.
guarantee_rate
guarantee
.
remaining_capital
*
guarantee
.
guarantee_rate
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter