Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
C
cgscop_adhesion
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
Confédération Générale des SCOP
cgscop_adhesion
Validations
6e65eec8
Valider
6e65eec8
rédigé
6 mai 2021
par
jordan
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[update] lm and lf adhesion
parent
1f1e1ec7
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
models/res_partner.py
+115
-20
115 ajouts, 20 suppressions
models/res_partner.py
views/res_partner.xml
+4
-1
4 ajouts, 1 suppression
views/res_partner.xml
avec
119 ajouts
et
21 suppressions
models/res_partner.py
+
115
−
20
Voir le fichier @
6e65eec8
...
@@ -87,22 +87,12 @@ class ScopPartner(models.Model):
...
@@ -87,22 +87,12 @@ class ScopPartner(models.Model):
# ------------------------------------------------------
# ------------------------------------------------------
# Actions
# Actions
# ------------------------------------------------------
# ------------------------------------------------------
def
scop_lm_inscription
(
self
):
def
scop_lm_adhesion
(
self
):
year_inscription
=
self
.
date_1st_sign
.
year
"""
dossier_type_inscription_id
=
self
.
env
.
ref
(
:return: Form View LM
'
cgscop_liste_ministere.liste_ministere_type_1
'
).
id
"""
lm_inscritption
=
self
.
env
[
'
liste.ministere
'
].
search
([
self
.
ensure_one
()
(
'
year
'
,
'
=
'
,
year_inscription
),
lm_adhesion
=
self
.
get_lm_adhesion
()
(
'
partner_id
'
,
'
=
'
,
self
.
id
),
(
'
type_id
'
,
'
=
'
,
dossier_type_inscription_id
)
])
if
not
lm_inscritption
:
lm_inscritption
=
self
.
env
[
'
liste.ministere
'
].
create
({
'
partner_id
'
:
self
.
id
,
'
year
'
:
self
.
date_1st_sign
.
year
,
'
type_id
'
:
dossier_type_inscription_id
})
lm_inscritption
.
action_publish_without_extranet
()
form_id
=
self
.
env
.
ref
(
form_id
=
self
.
env
.
ref
(
"
cgscop_liste_ministere.view_liste_ministere_delegue_form
"
)
"
cgscop_liste_ministere.view_liste_ministere_delegue_form
"
)
return
{
return
{
...
@@ -110,9 +100,111 @@ class ScopPartner(models.Model):
...
@@ -110,9 +100,111 @@ class ScopPartner(models.Model):
'
res_model
'
:
'
liste.ministere
'
,
'
res_model
'
:
'
liste.ministere
'
,
'
view_mode
'
:
'
form
'
,
'
view_mode
'
:
'
form
'
,
'
views
'
:
[[
form_id
.
id
,
'
form
'
]],
'
views
'
:
[[
form_id
.
id
,
'
form
'
]],
'
res_id
'
:
lm_
inscritpt
ion
.
id
,
'
res_id
'
:
lm_
adhes
ion
.
id
,
}
}
def
scop_liasse_adhesion
(
self
):
"""
Liasse connue en année N → on utilise cette liasse
Pas de liasse → on crée une liasse prévisionnelle
:return:
"""
self
.
ensure_one
()
lm_adhesion
=
self
.
get_lm_adhesion
()
liasse_adhesion
=
self
.
get_liasse_adhesion
(
lm_adhesion
)
action
=
self
.
env
.
ref
(
'
cgscop_liste_ministere.scop_liasse_fiscale_previsionnelle_act_window
'
).
read
()[
0
]
action
.
update
({
'
target
'
:
'
new
'
,
'
res_id
'
:
liasse_adhesion
.
id
,
'
flags
'
:
{
'
action_buttons
'
:
False
}
})
return
action
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------
def
is_project_complete
(
self
):
"""
Check if project is complete : all fields LM and docs
:return:
"""
self
.
ensure_one
()
lm_adhesion
=
self
.
get_lm_adhesion
()
complete_fields
=
self
.
check_compulsory_fields
(
lm_adhesion
)
complete_docs
=
self
.
check_compulsory_docs
()
return
complete_fields
and
complete_docs
def
get_lm_adhesion
(
self
):
"""
- LM renouvellement existante en année N → on rattache à cette LM
- Pas de LM existante en année N
- LM connue dans l’historique → on crée une LM renouvellement
pour l’année N
- Pas de LM connue → on créée une LM inscription
"""
self
.
ensure_one
()
year_inscription
=
self
.
date_1st_sign
.
year
dossier_type_inscription_id
=
self
.
env
.
ref
(
'
cgscop_liste_ministere.liste_ministere_type_1
'
).
id
dossier_type_renouvellement_id
=
self
.
env
.
ref
(
'
cgscop_liste_ministere.liste_ministere_type_2
'
).
id
last_lm
=
self
.
get_last_lm
()
if
last_lm
and
last_lm
.
year
>=
year_inscription
:
lm_adhesion
=
last_lm
else
:
if
not
last_lm
:
type_lm
=
dossier_type_inscription_id
else
:
type_lm
=
dossier_type_renouvellement_id
lm_adhesion
=
self
.
env
[
'
liste.ministere
'
].
create
({
'
partner_id
'
:
self
.
id
,
'
year
'
:
year_inscription
,
'
type_id
'
:
type_lm
})
lm_adhesion
.
action_publish_without_extranet
()
return
lm_adhesion
def
get_last_lm
(
self
):
"""
Return last known lm for partner
"""
self
.
ensure_one
()
lm_ids
=
self
.
env
[
'
liste.ministere
'
].
search
([
(
'
partner_id
'
,
'
=
'
,
self
.
id
),
],
order
=
'
year desc
'
)
lm
=
lm_ids
[
0
]
if
lm_ids
else
None
return
lm
def
get_liasse_adhesion
(
self
,
lm
):
"""
Return or create liasse prévisionnel for lm
:param lm:
:return:
"""
year_inscription
=
self
.
date_1st_sign
.
year
liasse_type_previ_id
=
self
.
env
.
ref
(
'
cgscop_liste_ministere.liasse_type_1
'
).
id
liasse_adhesion
=
lm
.
scop_liasse_fiscale_id
if
not
liasse_adhesion
:
liasse_adhesion
=
self
.
env
[
'
scop.liasse.fiscale
'
].
create
({
'
liste_ministere_id
'
:
lm
.
id
,
'
partner_id
'
:
self
.
id
,
'
year
'
:
year_inscription
,
'
type_id
'
:
liasse_type_previ_id
})
return
liasse_adhesion
def
check_compulsory_fields
(
self
,
lm
):
return
True
def
check_compulsory_docs
(
self
):
return
True
# ------------------------------------------------------
# ------------------------------------------------------
# Override parent
# Override parent
# ------------------------------------------------------
# ------------------------------------------------------
...
@@ -124,9 +216,12 @@ class ScopPartner(models.Model):
...
@@ -124,9 +216,12 @@ class ScopPartner(models.Model):
@return : True
@return : True
"""
"""
if
self
.
is_project_complete
():
super
(
ScopPartner
,
self
).
scop_send_to_cg
()
super
(
ScopPartner
,
self
).
scop_send_to_cg
()
self
.
date_transmission_cg
=
fields
.
Date
.
today
()
self
.
date_transmission_cg
=
fields
.
Date
.
today
()
return
True
return
True
else
:
return
False
@api.multi
@api.multi
def
scop_abandonne
(
self
):
def
scop_abandonne
(
self
):
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
views/res_partner.xml
+
4
−
1
Voir le fichier @
6e65eec8
...
@@ -34,7 +34,10 @@
...
@@ -34,7 +34,10 @@
<field
name=
"arch"
type=
"xml"
>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//header/button[@name='scop_send_to_cg']"
position=
"before"
>
<xpath
expr=
"//header/button[@name='scop_send_to_cg']"
position=
"before"
>
<button
string=
"LM Inscription"
type=
"object"
name=
"scop_lm_inscription"
class=
"btn-primary"
<button
string=
"Liste Ministere"
type=
"object"
name=
"scop_lm_adhesion"
class=
"btn-primary"
attrs=
"{'invisible': ['|', ('write_date', '=', False), ('project_status', 'not in', ('4_adhesion', '5_cg'))]}"
groups=
"cgscop_partner.group_add_period"
/>
<button
string=
"Liasse Fiscale"
type=
"object"
name=
"scop_liasse_adhesion"
class=
"btn-primary"
attrs=
"{'invisible': ['|', ('write_date', '=', False), ('project_status', 'not in', ('4_adhesion', '5_cg'))]}"
attrs=
"{'invisible': ['|', ('write_date', '=', False), ('project_status', 'not in', ('4_adhesion', '5_cg'))]}"
groups=
"cgscop_partner.group_add_period"
/>
groups=
"cgscop_partner.group_add_period"
/>
</xpath>
</xpath>
...
...
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