23/07/2024 - 12h
parent
8cfc3c0c0e
commit
6897469e4d
|
@ -3,13 +3,10 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/07/2024 - 12h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
|
@ -6028,6 +6028,11 @@ def Update_AcceptAttendeeInscription_For_Initial_Formation(diction):
|
|||
|
||||
"""
|
||||
Fontion de validation / acceptation d'une inscription
|
||||
|
||||
23/07/2024 :
|
||||
A la validation, on regarde si l'inscription a un 'client_rattachement_id' alors on considère qu'il
|
||||
s'agit d'une inscription pour un client, on met le champ 'entreprise' à '1', si non à '0'
|
||||
|
||||
"""
|
||||
def AcceptAttendeeInscription(diction):
|
||||
try:
|
||||
|
@ -6064,10 +6069,17 @@ def AcceptAttendeeInscription(diction):
|
|||
|
||||
data_mail = {}
|
||||
|
||||
|
||||
|
||||
# 2 - Recuperation des données de l'inscription
|
||||
local_inscription = MYSY_GV.dbname['inscription'].find({'_id': ObjectId(str(diction['inscription_id'])),
|
||||
'email': str(diction['email']),
|
||||
'partner_owner_recid':str(partner_recid)})
|
||||
entreprise = "0"
|
||||
if ("client_rattachement_id" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['client_rattachement_id']:
|
||||
entreprise = "1"
|
||||
|
||||
lms_class_code = ""
|
||||
if ("lms_class_code" in local_inscription[0].keys()):
|
||||
if local_inscription[0]['lms_class_code']:
|
||||
|
@ -6203,7 +6215,7 @@ def AcceptAttendeeInscription(diction):
|
|||
|
||||
ret_val2 = MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id': ObjectId( str(diction['inscription_id'])), 'email': str(diction['email']), 'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": {'status':'1', 'inscription_validation_date':now, 'date_update':now
|
||||
{"$set": {'status':'1', 'inscription_validation_date':now, 'date_update':now, 'entreprise':str(entreprise)
|
||||
}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
|
@ -6548,7 +6560,7 @@ def AcceptAttendeeInscription(diction):
|
|||
|
||||
|
||||
"""
|
||||
Cette fonction acepte une liste d'inscrit à une session de formation
|
||||
Cette fonction accepte une liste d'inscrit à une session de formation
|
||||
"""
|
||||
def Accept_List_AttendeeInscription(diction):
|
||||
try:
|
||||
|
|
6456
Log/log_file.log
6456
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -9356,16 +9356,42 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide ", False
|
||||
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client
|
||||
liste_client_rattachement_id = []
|
||||
|
||||
liste_client_facturation_rattachement_id = MYSY_GV.dbname['inscription'].distinct("facture_client_rattachement_id",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"facture_client_rattachement_id": {'$ne': ''},
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {'$in': tab_my_inscription_ids_Object},
|
||||
}
|
||||
)
|
||||
|
||||
print(" ### la liste des liste_client_facturation_rattachement_id = ", liste_client_facturation_rattachement_id)
|
||||
|
||||
|
||||
# Ajout des client de facturation
|
||||
for tmp in liste_client_facturation_rattachement_id :
|
||||
liste_client_rattachement_id.append(tmp)
|
||||
|
||||
|
||||
|
||||
print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id)
|
||||
|
||||
"""
|
||||
Gestion des inscriptions n'ayant pas de client ID
|
||||
"""
|
||||
Gestion des inscriptions n'ayant pas de facture_client_rattachement_id
|
||||
"""
|
||||
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find(
|
||||
{"$or": [{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
"facture_client_rattachement_id": '',
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {'$in': tab_my_inscription_ids_Object},
|
||||
"_id": {'$in': tab_my_inscription_ids_Object},
|
||||
},
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
|
@ -9377,10 +9403,10 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
}
|
||||
)
|
||||
|
||||
|
||||
# CONTROLE : Verification des data client (si tous les clients 'particuliers' sont ok
|
||||
for local_inscription_no_client in liste_inscription_no_client:
|
||||
print(" ### List des inscrit n'ayant pas de 'client_id': ", local_inscription_no_client)
|
||||
print(" ### List des inscrit n'ayant pas de 'facture_client_rattachement_id': ",
|
||||
local_inscription_no_client)
|
||||
|
||||
"""
|
||||
- Verifier s'il y a un client avec la même adresse email,
|
||||
|
@ -9421,11 +9447,12 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
MYSY_GV.dbname['inscription'].update_one({'partner_owner_recid': str(my_partner['recid']),
|
||||
'_id': ObjectId(local_inscription_no_client['_id'])},
|
||||
{'$set': {
|
||||
'facture_client_rattachement_id': str(inscription_no_client_valide_no_locked_data['_id']),
|
||||
'facture_client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
'client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
# Si il n'y a pas de client associé à cette adresse email, alors on crée le client
|
||||
if (is_inscription_no_client_exist == 0):
|
||||
|
@ -9536,52 +9563,14 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
{'$set':
|
||||
{
|
||||
'facture_client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
inscription_no_client_valide_no_locked_data[
|
||||
'_id']),
|
||||
'client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id'])
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client
|
||||
liste_client_rattachement_id = []
|
||||
|
||||
liste_client_facturation_rattachement_id = MYSY_GV.dbname['inscription'].distinct("facture_client_rattachement_id",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"facture_client_rattachement_id": {'$ne': ''},
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {'$in': tab_my_inscription_ids_Object},
|
||||
}
|
||||
)
|
||||
|
||||
print(" ### la liste des liste_client_facturation_rattachement_id = ", liste_client_facturation_rattachement_id)
|
||||
|
||||
liste_client_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct(
|
||||
"client_rattachement_id",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"facture_client_rattachement_id": {'$ne': ''},
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {'$in': tab_my_inscription_ids_Object},
|
||||
}
|
||||
)
|
||||
|
||||
print(" ### la liste des liste_client_client_rattachement_id = ", liste_client_client_rattachement_id)
|
||||
|
||||
# Ajout des client de facturation
|
||||
for tmp in liste_client_facturation_rattachement_id :
|
||||
liste_client_rattachement_id.append(tmp)
|
||||
|
||||
# Ajout des client_client de facturation
|
||||
for tmp in liste_client_client_rattachement_id:
|
||||
liste_client_rattachement_id.append(tmp)
|
||||
|
||||
print(" ### la liste des liste_client_rattachement_id = ", liste_client_rattachement_id)
|
||||
|
||||
# Sauvegarde des fichiers joints depuis le front
|
||||
tab_saved_file_full_path = []
|
||||
|
@ -9882,9 +9871,27 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide ", False
|
||||
|
||||
|
||||
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client
|
||||
liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("facture_client_rattachement_id",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"facture_client_rattachement_id": {'$ne': ''},
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {
|
||||
'$in': tab_my_inscription_ids_Object},
|
||||
}
|
||||
)
|
||||
|
||||
print(" ### la liste des liste_client_rattachement_id (client à facturer) : AVANT GESTION inscriptions SANS CLIENT = ", liste_client_rattachement_id)
|
||||
|
||||
"""
|
||||
Gestion des inscriptions n'ayant pas de client à facturer ID
|
||||
"""
|
||||
Gestion des inscriptions n'ayant pas de client à facturer ID
|
||||
"""
|
||||
liste_inscription_no_client = MYSY_GV.dbname['inscription'].find(
|
||||
{"$or": [{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
|
@ -9936,7 +9943,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
return False, " Facturation : L'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " correspond à un client non valide ", False
|
||||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
# Mise à jour de l'inscription avec l'_id du nouveau client pour les champs : client_rattachement_id et facture_client_rattachement_id
|
||||
inscription_no_client_valide_no_locked_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
|
@ -9946,10 +9953,23 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
MYSY_GV.dbname['inscription'].update_one({'partner_owner_recid': str(my_partner['recid']),
|
||||
'_id': ObjectId(local_inscription_no_client['_id'])},
|
||||
{'$set': {'client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id'])}})
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
'facture_client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id'])
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
"""
|
||||
/!\ 23/07/2024 : Ajouter ce client dans la table : "liste_client_rattachement_id'.
|
||||
En fait, vu que la ligne d'inscription a maintenant un client_rattachement_id et facture_client_rattachement_id
|
||||
"""
|
||||
liste_client_rattachement_id.append(str(inscription_no_client_valide_no_locked_data['_id']))
|
||||
|
||||
|
||||
|
||||
# Si il n'y a pas de client associé à cette adresse email, alors on crée le client
|
||||
if (is_inscription_no_client_exist == 0):
|
||||
elif (is_inscription_no_client_exist == 0):
|
||||
|
||||
new_client_contact_data = {}
|
||||
new_client_data = {}
|
||||
|
@ -10051,26 +10071,22 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " WARNING : Impossible de créer le contact " + str(
|
||||
local_add_contact_retval))
|
||||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
# Mise à jour de l'inscription avec l'_id du nouveau client pour les champs : client_rattachement_id et facture_client_rattachement_id
|
||||
MYSY_GV.dbname['inscription'].update_one({'partner_owner_recid': str(my_partner['recid']),
|
||||
'_id': ObjectId(local_inscription_no_client['_id'])},
|
||||
{'$set': {'client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id'])}})
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
'facture_client_rattachement_id': str(
|
||||
inscription_no_client_valide_no_locked_data['_id']),
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client
|
||||
liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("facture_client_rattachement_id",
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"facture_client_rattachement_id": {'$ne': ''},
|
||||
"invoiced": {'$ne': '1'},
|
||||
"_id": {
|
||||
'$in': tab_my_inscription_ids_Object},
|
||||
}
|
||||
)
|
||||
}})
|
||||
|
||||
"""
|
||||
/!\ 23/07/2024 : Ajouter ce client dans la table : "liste_client_rattachement_id'.
|
||||
En fait, vu que la ligne d'inscription a maintenant un client_rattachement_id et facture_client_rattachement_id
|
||||
"""
|
||||
liste_client_rattachement_id.append(str(inscription_no_client_valide_no_locked_data['_id']))
|
||||
|
||||
print(" ### la liste des liste_client_rattachement_id (client à facturer) = ", liste_client_rattachement_id)
|
||||
|
||||
# Sauvegarde des fichiers joints depuis le front
|
||||
tab_saved_file_full_path = []
|
||||
|
@ -10088,7 +10104,14 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
|
||||
tab_local_invoice_ref_interne = []
|
||||
|
||||
# Envoie des factures pour les inscrits AVEC client_id (conventions d'entreprise)
|
||||
"""
|
||||
/!\ : 23/07/2024 : A présent, toutes les lignes ont un client_rattachement_id et facture_client_rattachement_id
|
||||
car pour ceux qui n'en avaient pas, la creation a ete faite ci-dessus.
|
||||
"""
|
||||
print( " ### la liste des liste_client_rattachement_id (client à facturer) : APRES GESTION inscriptions SANS CLIENT = ",
|
||||
liste_client_rattachement_id)
|
||||
|
||||
# Envoie des factures pour les inscrits AVEC client_id
|
||||
for single_client in liste_client_rattachement_id:
|
||||
print(" Traitement du client_id (client à facturer) = ", single_client)
|
||||
|
||||
|
|
|
@ -1484,7 +1484,7 @@ def Get_Given_Session_Action_Status_By_Document(diction):
|
|||
si au moins 1, on met : partiel
|
||||
la clé est : courrier_template_tracking.courrier_template_type_document_ref_interne
|
||||
|
||||
-- clé de recherhce : document a traquer (courrier_template_tracking._id) et inscription_id
|
||||
-- clé de recherche : document a traquer (courrier_template_tracking._id) et inscription_id
|
||||
|
||||
/!\ 08/05/2024 : cette logique n'est pas valable dans le cas des convention car certains partipants
|
||||
doivent avoir une convention entreprise alors que d'autres ont un convention individuelle
|
||||
|
@ -1505,14 +1505,15 @@ def Get_Given_Session_Action_Status_By_Document(diction):
|
|||
inscrit_with_client_count = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'session_id':str(diction['session_id']),
|
||||
'status': '1',
|
||||
'entreprise': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"client_rattachement_id": { '$ne': ''}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
local_nb_inscrit = inscrit_with_client_count
|
||||
print(" ### NB INSC CONVENTION_STAGIAIRE_ENTREPRISE = ", inscrit_with_client_count)
|
||||
|
||||
for val in List_participant:
|
||||
local_qry = {'partner_owner_recid': str(my_partner['recid']),
|
||||
|
@ -1539,20 +1540,15 @@ def Get_Given_Session_Action_Status_By_Document(diction):
|
|||
|
||||
elif( doc_a_tracker['courrier_template_type_document_ref_interne'] == "CONVENTION_STAGIAIRE_INDIVIDUELLE") :
|
||||
|
||||
inscrit_without_client_count = MYSY_GV.dbname['inscription'].count_documents({"$or": [{'session_id': str(diction['session_id']),
|
||||
inscrit_without_client_count = MYSY_GV.dbname['inscription'].count_documents({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'entreprise': {'$ne': '1'},
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
"client_rattachement_id": ''
|
||||
},
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id': {'$exists': False}
|
||||
}]
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
local_nb_inscrit = inscrit_without_client_count
|
||||
print(" ### NB INSC CONVENTION_STAGIAIRE_INDIVIDUELLE = ", inscrit_without_client_count)
|
||||
|
||||
for val in List_participant:
|
||||
local_qry = {'partner_owner_recid': str(my_partner['recid']),
|
||||
|
|
Loading…
Reference in New Issue