parent
5421cf386f
commit
9f22ceabf2
|
|
@ -4,72 +4,17 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="18/02/2026 - 18h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/02/26 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/BPF.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/factures_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/formation_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/formation_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/inscription_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/inscription_tdb_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.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_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/abonnement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/abonnement_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/admission_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/admission_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/appel_offre.py" beforeDir="false" afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attestation_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/attestation_formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_document_automatic_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_document_automatic_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/categorie_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/categorie_formation_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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/competence_pedagogique.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence_pedagogique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_alert_messages.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_alert_messages.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/equipe_team_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/equipe_team_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_client_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/invoice_paiement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/invoice_paiement_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/metier_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/metier_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/paiement_condition.py" beforeDir="false" afterPath="$PROJECT_DIR$/paiement_condition.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_produit_service_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_produit_service_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/purchase_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/purchase_prices.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/session_admission_fi.py" beforeDir="false" afterPath="$PROJECT_DIR$/session_admission_fi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/type_cours.py" beforeDir="false" afterPath="$PROJECT_DIR$/type_cours.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -513,7 +458,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="535" />
|
||||
<option name="localTasksCounter" value="536" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -555,7 +500,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="04/11/2025 - 12h" />
|
||||
<MESSAGE value="12/11/2025 - 22h30" />
|
||||
<MESSAGE value="13/11/2025 - 22h30" />
|
||||
<MESSAGE value="15/11/2025 - 22h30" />
|
||||
|
|
@ -580,6 +524,7 @@
|
|||
<MESSAGE value="15/02/26 - 18h30" />
|
||||
<MESSAGE value="16/02/26 - 18h30" />
|
||||
<MESSAGE value="18/02/2026 - 18h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="18/02/2026 - 18h" />
|
||||
<MESSAGE value="21/02/26 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="21/02/26 - 20h" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1967,7 +1967,7 @@ def Create_E_Signature_For_E_Invoice(file_img=None, Folder=None, diction=None):
|
|||
Si il s'agit d'un devis, alors on procede a la resevation des places
|
||||
"""
|
||||
|
||||
print(" ### e_docment_type zzzz pour resevation de place = ", e_docment_type)
|
||||
#print(" ### e_docment_type zzzz pour resevation de place = ", e_docment_type)
|
||||
|
||||
if (str(e_docment_type).strip().lower() == "quotation"):
|
||||
|
||||
|
|
|
|||
|
|
@ -15429,7 +15429,11 @@ def Get_Insription_From_Session_id_Reduice_Fields_With_Filter(diction):
|
|||
if diction['tab_statut_ids']:
|
||||
tab_statut_ids = diction['tab_statut_ids']
|
||||
|
||||
tab_statut_ids_splited = str(tab_statut_ids).split(",")
|
||||
tab_statut_ids_splited = []
|
||||
tab_statut_ids_splited_work = str(tab_statut_ids).split(",")
|
||||
for tmp in tab_statut_ids_splited_work:
|
||||
if( tmp ):
|
||||
tab_statut_ids_splited.append(tmp)
|
||||
|
||||
|
||||
## Recuperation de toutes les stagiaire rattaché à cette session
|
||||
|
|
@ -15438,11 +15442,11 @@ def Get_Insription_From_Session_id_Reduice_Fields_With_Filter(diction):
|
|||
myquery['session_id'] = session_id
|
||||
myquery['status'] = "1"
|
||||
myquery['valide'] = "1"
|
||||
|
||||
if (len(tab_statut_ids_splited) > 0):
|
||||
myquery['status'] = {'$in': tab_statut_ids_splited}
|
||||
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
|
|
|
|||
6016
Log/log_file.log
6016
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -10747,7 +10747,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
|
||||
# Creation de la facture du client
|
||||
|
|
@ -11139,7 +11139,7 @@ def Prepare_and_Send_Facture_From_Session_By_Email_SAVE_ORIG(tab_files, Folder,
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
|
||||
# Creation de la facture du client
|
||||
|
|
@ -11465,11 +11465,31 @@ def Invoice_Partner_From_Session( diction):
|
|||
|
||||
prix_session = mycommon.tryFloat(str(session_data['prix_session']))
|
||||
|
||||
"""
|
||||
22/02/2026 :
|
||||
il faut plutot aller cherche le prix qui sur la fiche inscription. car c'est lui le vrai unitaire
|
||||
(par exemple on fait une reduction a un inscrit donnée)
|
||||
"""
|
||||
|
||||
prix_inscription_str = "0"
|
||||
local_inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'facture_client_rattachement_id': str(
|
||||
diction['partner_client_id'])})
|
||||
|
||||
if ("price" in local_inscription_data[0].keys()):
|
||||
prix_inscription_str = local_inscription_data[0]['price']
|
||||
else:
|
||||
prix_inscription_str = str(prix_session)
|
||||
|
||||
prix_inscription = mycommon.tryFloat(prix_inscription_str)
|
||||
|
||||
|
||||
if( str(price_by).strip() == "persession" ):
|
||||
total_ht = round(prix_session, 2)
|
||||
else:
|
||||
total_ht = round(prix_session * nb_valide_inscription_pr_client, 2)
|
||||
total_ht = round(prix_inscription * nb_valide_inscription_pr_client, 2)
|
||||
|
||||
partner_invoice_header_data['total_header_hors_taxe_before_header_reduction'] = total_ht
|
||||
|
||||
|
|
@ -11597,7 +11617,12 @@ def Invoice_Partner_From_Session( diction):
|
|||
partner_invoice_line_data['order_line_class_id'] = str(class_data[0]['_id'])
|
||||
partner_invoice_line_data['order_line_session_id'] = str(diction['session_id'])
|
||||
partner_invoice_line_data['order_line_qty'] = str(nb_participant_du_client)
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
|
||||
if (str(price_by).strip() == "persession"):
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
else:
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_inscription)
|
||||
|
||||
partner_invoice_line_data['order_line_montant_hors_taxes'] = str(total_ht)
|
||||
partner_invoice_line_data['order_line_comment'] = str(nom_prenom_email_participant)
|
||||
partner_invoice_line_data['invoice_header_id'] = str(inserted_invoice_id)
|
||||
|
|
@ -12802,7 +12827,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
# Creation de la facture du client
|
||||
diction_invoice = {}
|
||||
|
|
@ -12810,7 +12835,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
diction_invoice['partner_client_id'] = single_client
|
||||
diction_invoice['session_id'] = diction['session_id']
|
||||
diction_invoice['tab_inscription_ids'] = tab_my_inscription_ids_Object
|
||||
print(" ##### liste_client_facturation_rattachement_id : diction_invoice 0202 icici = ", diction_invoice)
|
||||
#print(" ##### liste_client_facturation_rattachement_id : diction_invoice 0202 icici = ", diction_invoice)
|
||||
local_create_invoice_status, local_create_invoice_retval, local_invoice_ref_interne = Invoice_Partner_From_Session_By_Inscription_Id(
|
||||
diction_invoice)
|
||||
if (local_create_invoice_status is False):
|
||||
|
|
@ -12870,7 +12895,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
# Creation de la facture du client
|
||||
diction_invoice = {}
|
||||
|
|
@ -12878,7 +12903,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id(tab_files, Folder, d
|
|||
diction_invoice['partner_client_id'] = single_client
|
||||
diction_invoice['session_id'] = diction['session_id']
|
||||
diction_invoice['tab_inscription_ids'] = tab_my_inscription_ids_Object
|
||||
print(" ##### liste_client_client_rattachement_id : diction_invoice 0202 icici = ", diction_invoice)
|
||||
#print(" ##### liste_client_client_rattachement_id : diction_invoice 0202 icici = ", diction_invoice)
|
||||
local_create_invoice_status, local_create_invoice_retval, local_invoice_ref_interne = Invoice_Partner_From_Session_By_Inscription_Id(
|
||||
diction_invoice)
|
||||
if (local_create_invoice_status is False):
|
||||
|
|
@ -13320,7 +13345,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
# Creation de la facture du client
|
||||
diction_invoice = {}
|
||||
|
|
@ -13328,7 +13353,7 @@ def Prepare_and_Send_Facture_From_Session_By_Inscription_Id_SAVE_ORIG(tab_files,
|
|||
diction_invoice['partner_client_id'] = single_client
|
||||
diction_invoice['session_id'] = diction['session_id']
|
||||
diction_invoice['tab_inscription_ids'] = tab_my_inscription_ids_Object
|
||||
print(" ##### diction_invoice 0202 tttt = ", diction_invoice)
|
||||
#print(" ##### diction_invoice 0202 tttt = ", diction_invoice)
|
||||
local_create_invoice_status, local_create_invoice_retval, local_invoice_ref_interne = Invoice_Partner_From_Session_By_Inscription_Id(
|
||||
diction_invoice)
|
||||
if (local_create_invoice_status is False):
|
||||
|
|
@ -13510,7 +13535,7 @@ def Prepare_and_Send_SPLITED_Facture_From_Session_By_Inscription_Id(tab_files, F
|
|||
new_diction_client['email_production'] = str(list_local_email_production)
|
||||
new_diction_client['session_id'] = diction['session_id']
|
||||
|
||||
print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
#print(" ##### new_diction_client 0102 = ", new_diction_client)
|
||||
|
||||
# Creation de la facture du client
|
||||
diction_invoice = {}
|
||||
|
|
@ -13518,7 +13543,7 @@ def Prepare_and_Send_SPLITED_Facture_From_Session_By_Inscription_Id(tab_files, F
|
|||
diction_invoice['partner_client_id'] = single_client
|
||||
diction_invoice['session_id'] = diction['session_id']
|
||||
diction_invoice['tab_inscription_ids'] = tab_my_inscription_ids_Object
|
||||
print(" ##### diction_invoice 0202 tttt = ", diction_invoice)
|
||||
#print(" ##### diction_invoice 0202 tttt = ", diction_invoice)
|
||||
local_create_invoice_status, local_create_invoice_retval, local_invoice_ref_interne = Invoice_Partner_From_Session_By_Inscription_Id(
|
||||
diction_invoice)
|
||||
if (local_create_invoice_status is False):
|
||||
|
|
@ -13619,11 +13644,20 @@ def Prepare_and_Send_SPLITED_Facture_From_Session_By_Inscription_Id(tab_files, F
|
|||
|
||||
|
||||
"""
|
||||
Ccreation des factures pour un client avec uniquement la liste des inscriptions concernées.
|
||||
|
||||
Création des factures pour un client avec uniquement la liste des inscriptions concernées.
|
||||
Ex : je veux facturer que 2 des 5 inscrits d'un client donné.
|
||||
|
||||
Important : : Cette fonction se base sur le champ "facture_client_rattachement_id" de la collection "inscription"
|
||||
Important : Cette fonction se base sur le champ "facture_client_rattachement_id" de la collection "inscription"
|
||||
|
||||
22/02/26 : Importante regles :
|
||||
Vu qu'on va aller chercher le prix sur la ligne de l'inscrit si le 'price_by' sur la session est "stagiaire".
|
||||
|
||||
Alors pour un client données, tous ses apprenant doivent etre un meme tarif pour avoir une factur globale.
|
||||
|
||||
Regle : tous les inscrit d'un client doivent avoir le meme prix unitaire.
|
||||
==> on ne prendra a chaque fois que le prix de inscription_data[0]['price']
|
||||
(ultérieurement on pourra faire evoluer cette regle)
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -13696,6 +13730,8 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
tab_inscrit_partial_data = []
|
||||
tab_apprenant = []
|
||||
tab_participant = []
|
||||
|
||||
|
||||
for val in inscription_data:
|
||||
tab_participant.append(val['_id'])
|
||||
|
||||
|
|
@ -13747,8 +13783,8 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
if( "perstagiaire" in session_data.keys() ):
|
||||
price_by = session_data['perstagiaire']
|
||||
if( price_by not in MYSY_GV.TRAINING_PRICE) :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le prix par " + str(price_by) + " n'est valide. Les valeurs autorisées sont " + str(MYSY_GV.TRAINING_PRICE))
|
||||
return False, " Le prix par " + str(price_by) + " n'est valide. Les valeurs autorisées sont " + str(MYSY_GV.TRAINING_PRICE) + " ", False
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le prix par " + str(price_by) + " n'est pas valide. Les valeurs autorisées sont " + str(MYSY_GV.TRAINING_PRICE))
|
||||
return False, " Le prix par " + str(price_by) + " n'est pas valide. Les valeurs autorisées sont " + str(MYSY_GV.TRAINING_PRICE) + " ", False
|
||||
|
||||
partner_invoice_header_data = {}
|
||||
|
||||
|
|
@ -13892,21 +13928,46 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
total_ht = 0
|
||||
prix_session = 0
|
||||
session_price = 0
|
||||
|
||||
|
||||
|
||||
if( "prix_session" not in session_data.keys() ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Facturation : La promotion n'a pas de prix valide")
|
||||
return False, " Facturation : La promotion n'a pas de prix valide ", False
|
||||
return False, " Facturation : La promotion / Session n'a pas de prix valide ", False
|
||||
|
||||
if( str(session_data['prix_session']).strip() == "" ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Facturation : La promotion n'a pas de prix valide (2) ")
|
||||
return False, " Facturation : La promotion n'a pas de prix valide (2) ", False
|
||||
return False, " Facturation : La promotion / Session n'a pas de prix valide (2) ", False
|
||||
|
||||
prix_session = mycommon.tryFloat(str(session_data['prix_session']))
|
||||
|
||||
"""
|
||||
22/02/2026 :
|
||||
il faut plutot aller cherche le prix qui sur la fiche inscription. car c'est lui le vrai unitaire
|
||||
(par exemple on fait une reduction a un inscrit donnée)
|
||||
"""
|
||||
|
||||
prix_inscription_str = "0"
|
||||
local_inscription_data = MYSY_GV.dbname['inscription'].find({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'facture_client_rattachement_id': str(
|
||||
diction['partner_client_id']),
|
||||
'_id': {'$in': diction['tab_inscription_ids']}})
|
||||
|
||||
|
||||
if ("price" in local_inscription_data[0].keys()):
|
||||
prix_inscription_str = local_inscription_data[0]['price']
|
||||
else:
|
||||
prix_inscription_str = str(prix_session)
|
||||
|
||||
prix_inscription = mycommon.tryFloat(prix_inscription_str)
|
||||
|
||||
|
||||
if( str(price_by).strip() == "persession" ):
|
||||
total_ht = round(prix_session, 2)
|
||||
else:
|
||||
total_ht = round(prix_session * nb_valide_inscription_pr_client, 2)
|
||||
total_ht = round(prix_inscription * nb_valide_inscription_pr_client, 2)
|
||||
|
||||
partner_invoice_header_data['total_header_hors_taxe_before_header_reduction'] = total_ht
|
||||
|
||||
|
|
@ -14040,7 +14101,12 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data['order_line_formation'] = class_data[0]['internal_url']
|
||||
partner_invoice_line_data['order_line_class_id'] = str(class_data[0]['_id'])
|
||||
partner_invoice_line_data['order_line_qty'] = str(nb_participant_du_client)
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
|
||||
if (str(price_by).strip() == "persession"):
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
else:
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_inscription)
|
||||
|
||||
partner_invoice_line_data['order_line_montant_hors_taxes'] = str(total_ht)
|
||||
partner_invoice_line_data['order_line_comment'] = str(nom_prenom_email_participant)
|
||||
partner_invoice_line_data['invoice_header_id'] = str(inserted_invoice_id)
|
||||
|
|
@ -14058,7 +14124,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data['order_line_is_include_bpf'] = order_line_is_include_bpf
|
||||
|
||||
|
||||
print(" #### partner_invoice_line_data 33 = ", partner_invoice_line_data)
|
||||
|
||||
inserted_invoice_id = MYSY_GV.dbname['partner_invoice_line'].insert_one(
|
||||
partner_invoice_line_data).inserted_id
|
||||
if (not inserted_invoice_id):
|
||||
|
|
@ -14118,7 +14184,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data_detail['order_line_montant_hors_taxes'] = str(total_ht)
|
||||
partner_invoice_line_data_detail['order_line_invoiced_amount'] = str(order_line_montant_hors_taxes_par_apprenant)
|
||||
partner_invoice_line_data_detail['order_line_comment'] = str(nom_prenom_email_participant)
|
||||
partner_invoice_line_data_detail['invoice_header_id'] = str(inserted_invoice_id)
|
||||
partner_invoice_line_data_detail['invoice_header_id'] = str(new_invoice_id)
|
||||
partner_invoice_line_data_detail['invoice_line_type'] = "facture"
|
||||
partner_invoice_line_data_detail['invoice_header_ref_interne'] = partner_invoice_header_data[
|
||||
'invoice_header_ref_interne']
|
||||
|
|
@ -14133,7 +14199,7 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data_detail['locked'] = "0"
|
||||
partner_invoice_line_data_detail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
print(" #### partner_invoice_line_data 77 = ", partner_invoice_line_data)
|
||||
|
||||
inserted_invoice_id = MYSY_GV.dbname['partner_invoice_line_detail'].insert_one(
|
||||
partner_invoice_line_data_detail).inserted_id
|
||||
|
||||
|
|
@ -14487,11 +14553,35 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
|
|||
|
||||
prix_session = mycommon.tryFloat(str(session_data['prix_session']))
|
||||
|
||||
"""
|
||||
22/02/2026 :
|
||||
il faut plutot aller cherche le prix qui sur la fiche inscription. car c'est lui le vrai unitaire
|
||||
(par exemple on fait une reduction a un inscrit donnée)
|
||||
"""
|
||||
|
||||
prix_inscription_str = "0"
|
||||
local_inscription_data = MYSY_GV.dbname['inscription'].find_one({'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'_id': ObjectId(str(diction['inscription_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
"invoice_split": {'$ne': ''},
|
||||
'invoice_split': {'$exists': True},
|
||||
"invoiced": {'$ne': '1'},
|
||||
|
||||
})
|
||||
|
||||
if ("price" in local_inscription_data[0].keys()):
|
||||
prix_inscription_str = local_inscription_data[0]['price']
|
||||
else:
|
||||
prix_inscription_str = str(prix_session)
|
||||
|
||||
prix_inscription = mycommon.tryFloat(prix_inscription_str)
|
||||
|
||||
|
||||
if( str(price_by).strip() == "persession" ):
|
||||
total_ht = round(prix_session, 2)
|
||||
else:
|
||||
total_ht = round(prix_session * 1, 2)
|
||||
total_ht = round(prix_inscription * 1, 2)
|
||||
|
||||
|
||||
# Recupération de la TVA de l'entité qui facture
|
||||
|
|
@ -14648,7 +14738,13 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
|
|||
partner_invoice_line_data['order_line_session_id'] = str(diction['session_id'])
|
||||
|
||||
partner_invoice_line_data['order_line_qty'] = str(nb_participant_du_client)
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
|
||||
if (str(price_by).strip() == "persession"):
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_session)
|
||||
else:
|
||||
partner_invoice_line_data['order_line_prix_unitaire'] = str(prix_inscription)
|
||||
|
||||
|
||||
partner_invoice_line_data['order_line_montant_hors_taxes'] = str(total_ht)
|
||||
partner_invoice_line_data['order_line_comment'] = str(nom_prenom_email_participant)
|
||||
partner_invoice_line_data['invoice_header_id'] = str(inserted_invoice_id)
|
||||
|
|
@ -15096,10 +15192,7 @@ def Invoice_Create_Secure_E_Document(diction):
|
|||
"""
|
||||
tab_inscription = []
|
||||
for inscription_id in retval['tab_inscription_ids']:
|
||||
print(" ## ICI QURYYY = ", {'order_line_inscription_id':str(inscription_id),
|
||||
'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(retval['partner_owner_recid']),
|
||||
'invoice_header_ref_interne':str(retval['invoice_header_ref_interne'])})
|
||||
|
||||
|
||||
invoice_inscription_id_data = MYSY_GV.dbname['partner_invoice_line_detail'].find_one({'order_line_inscription_id':str(inscription_id),
|
||||
'valide':'1', 'locked':'0',
|
||||
|
|
@ -15117,7 +15210,7 @@ def Invoice_Create_Secure_E_Document(diction):
|
|||
})
|
||||
tab_inscription.append(invoice_inscription_id_data)
|
||||
|
||||
print(" UUU tab_inscription = ", tab_inscription)
|
||||
#print(" UUU tab_inscription = ", tab_inscription)
|
||||
user['inscription_data'] = tab_inscription
|
||||
|
||||
Order_header_lines_data.append(user)
|
||||
|
|
|
|||
|
|
@ -817,7 +817,6 @@ def Get_List_competence_pedagogique_Having_Given_List_Activite(diction):
|
|||
local_qry = {'$and': [{"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', },
|
||||
{'tab_activite_pedagogique._id':ObjectId(data)},] }
|
||||
|
||||
print("local_qry = ", local_qry)
|
||||
|
||||
activite_pedago_data = MYSY_GV.dbname['activite_pedagogique'].find_one(
|
||||
{'_id': ObjectId(str(data)), 'valide': '1'},
|
||||
|
|
@ -825,8 +824,6 @@ def Get_List_competence_pedagogique_Having_Given_List_Activite(diction):
|
|||
|
||||
|
||||
|
||||
print(" ## activite_pedago_data = ", activite_pedago_data)
|
||||
|
||||
if( activite_pedago_data ):
|
||||
|
||||
for competence_pedagogique in MYSY_GV.dbname['competence_pedagogique'].find(local_qry):
|
||||
|
|
@ -841,7 +838,7 @@ def Get_List_competence_pedagogique_Having_Given_List_Activite(diction):
|
|||
|
||||
local_id = local_id + 1
|
||||
|
||||
print(" ## local_node = ", local_node)
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(local_node))
|
||||
|
||||
|
|
|
|||
14
main.py
14
main.py
|
|
@ -931,7 +931,6 @@ def update_partner_account():
|
|||
else:
|
||||
file_logo = None
|
||||
|
||||
|
||||
if ('file_cachet' in request.files.keys()):
|
||||
file_cachet = request.files['file_cachet']
|
||||
else:
|
||||
|
|
@ -10821,6 +10820,19 @@ def Compute_Invoice_Header():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API pour Récuprer toutes les factures qui concernent un inscrit
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Inscrit_Invoices/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Inscrit_Invoices():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Inscrit_Invoices payload = ",payload)
|
||||
status, retval = partner_invoice.Get_Given_Inscrit_Invoices(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -3356,11 +3356,6 @@ def Get_Partner_Client_Communication_Contact(diction):
|
|||
|
||||
# Verifier la validité du client
|
||||
|
||||
print(" ### qru 010101 = ",{"_id":ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])}
|
||||
)
|
||||
|
||||
is_client_exist_valide = MYSY_GV.dbname['partner_client'].count_documents({"_id":ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
|
|
|
|||
|
|
@ -5096,6 +5096,12 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
local_credit_note_line['update_by'] = str(my_partner['_id'])
|
||||
local_credit_note_line['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
if( "tab_inscription_ids" in local_invoice_line.keys()):
|
||||
local_credit_note_line['tab_inscription_ids'] = local_invoice_line['tab_inscription_ids']
|
||||
|
||||
|
||||
|
||||
|
||||
if ("_id" in local_credit_note_line.keys()):
|
||||
del local_credit_note_line['_id']
|
||||
|
||||
|
|
@ -5134,6 +5140,9 @@ def Create_Invoice_Avoir_Total(diction):
|
|||
local_credit_note_line_detail['update_by'] = str(my_partner['_id'])
|
||||
local_credit_note_line_detail['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
if ("tab_inscription_ids" in local_invoice_line.keys()):
|
||||
local_credit_note_line['tab_inscription_ids'] = local_invoice_line['tab_inscription_ids']
|
||||
|
||||
if ("_id" in local_credit_note_line_detail.keys()):
|
||||
del local_credit_note_line_detail['_id']
|
||||
|
||||
|
|
@ -5287,7 +5296,7 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
"order_header_is_client", "order_header_is_fournisseur", "order_header_is_company",
|
||||
"order_header_type_pouvoir_public_id", "order_header_is_include_bpf", "order_header_comment",
|
||||
"invoice_lines", "order_header_description", "invoice_header_comment", "order_header_lieu_formation",
|
||||
"order_header_condition_paiement_id", "order_header_inclus_bpf", "invoice_header_description"]
|
||||
"order_header_inclus_bpf", "invoice_header_description"]
|
||||
|
||||
"""
|
||||
Important : A noter que "invoice_lines" est tableau [] qui peut contenir les keys suivantes : 'order_line_formation', 'order_line_qty', 'order_line_prix_unitaire', 'order_line_tax', 'order_line_type_reduction', 'order_line_type_valeur', 'order_line_montant_reduction'
|
||||
|
|
@ -5368,8 +5377,36 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
data['order_header_adr_liv_pays'] = is_client_data['adr_pays']
|
||||
data['order_header_condition_paiement_id'] = is_client_data['invoice_condition_paiement_id']
|
||||
|
||||
"""
|
||||
Calcul de la date d'échéance
|
||||
"""
|
||||
if( is_client_data['invoice_condition_paiement_id'] ):
|
||||
|
||||
client_condition_paiement = is_client_data['invoice_condition_paiement_id']
|
||||
paiement_condition_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(client_condition_paiement)),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
|
||||
if( paiement_condition_data ):
|
||||
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
|
||||
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "mois"):
|
||||
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
|
||||
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
|
||||
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "facture"):
|
||||
date_echance = today + timedelta(days=nb_jour_int)
|
||||
|
||||
date_echance = date_echance.strftime("%d/%m/%Y")
|
||||
|
||||
data['invoice_date_echeance'] = str(date_echance)
|
||||
|
||||
invoice_header_description = ""
|
||||
if ("order_header_description" in diction.keys()):
|
||||
|
|
@ -5421,17 +5458,69 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
return False, " - Le champ 'Lieu de formation' fait plus de 1000 caractères ", False
|
||||
data['order_header_lieu_formation'] = diction['order_header_lieu_formation']
|
||||
|
||||
"""
|
||||
Verifier la validité de la condition de paiement
|
||||
"""
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
if diction['order_header_condition_paiement_id']:
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement_id' fait plus de 255 caractères ")
|
||||
if ("order_header_condition_paiement_id" in diction.keys() and diction['order_header_condition_paiement_id']):
|
||||
is_valide_condition_paiement_id = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents({'_id':ObjectId(str(diction['order_header_condition_paiement_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères ", False
|
||||
data['order_header_condition_paiement_id'] = order_header_condition_paiement_id
|
||||
if( is_valide_condition_paiement_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La condition de paiement est invalide ")
|
||||
|
||||
return False, " La condition de paiement est invalide ", False
|
||||
|
||||
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
"""
|
||||
Calcul de la date d'échéance
|
||||
"""
|
||||
paiement_condition_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(diction['order_header_condition_paiement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "mois"):
|
||||
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
|
||||
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
|
||||
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "facture"):
|
||||
date_echance = today + timedelta(days=nb_jour_int)
|
||||
|
||||
|
||||
date_echance = date_echance.strftime("%d/%m/%Y")
|
||||
data['invoice_date_echeance'] = str(date_echance)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du vendeur
|
||||
"""
|
||||
if( "order_header_vendeur_id" in diction.keys() and diction['order_header_vendeur_id']):
|
||||
is_valide_vendeur_id = MYSY_GV.dbname['ressource_humaine'].count_documents({'_id':ObjectId(str(diction['order_header_vendeur_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
if( is_valide_vendeur_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du vendeur est invalide ")
|
||||
|
||||
return False, " L'identifiant du vendeur est invalide ", False
|
||||
|
||||
data['order_header_vendeur_id'] = diction['order_header_vendeur_id']
|
||||
|
||||
|
||||
order_header_condition_paiement_code = ""
|
||||
|
|
@ -5700,6 +5789,7 @@ def Add_Partner_Draft_Invoice(diction):
|
|||
data['creation_by'] = str(my_partner['_id'])
|
||||
data['creation_date'] = now
|
||||
|
||||
|
||||
print(" ### add_partner_order data = ", data)
|
||||
inserted_id = ""
|
||||
inserted_id = MYSY_GV.dbname['partner_invoice_header'].insert_one(data).inserted_id
|
||||
|
|
@ -5950,18 +6040,47 @@ def Update_Partner_Draft_Invoice(diction):
|
|||
data['order_header_lieu_formation'] = diction['order_header_lieu_formation']
|
||||
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
if diction['order_header_condition_paiement_id']:
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement_id' fait plus de 255 caractères ")
|
||||
if ("order_header_condition_paiement_id" in diction.keys() and diction['order_header_condition_paiement_id']):
|
||||
is_valide_condition_paiement_id = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents(
|
||||
{'_id': ObjectId(str(diction['order_header_condition_paiement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_condition_paiement_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La condition de paiement est invalide ")
|
||||
|
||||
return False, " La condition de paiement est invalide ", False
|
||||
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
"""
|
||||
Calcul de la date d'échéance
|
||||
"""
|
||||
paiement_condition_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(diction['order_header_condition_paiement_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
nb_jour_int = mycommon.tryInt(str(paiement_condition_data['nb_jour']))
|
||||
today = datetime.today()
|
||||
date_echance = datetime.today()
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "mois"):
|
||||
days_in_month = lambda dt: monthrange(dt.year, dt.month)[1]
|
||||
first_day_next_month = today.replace(day=1) + timedelta(days_in_month(today))
|
||||
date_echance = first_day_next_month + timedelta(days=nb_jour_int)
|
||||
|
||||
if (str(paiement_condition_data['depart']) == "facture"):
|
||||
date_echance = today + timedelta(days=nb_jour_int)
|
||||
|
||||
date_echance = date_echance.strftime("%d/%m/%Y")
|
||||
data['invoice_date_echeance'] = str(date_echance)
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères ", False
|
||||
data['order_header_condition_paiement_id'] = order_header_condition_paiement_id
|
||||
|
||||
print("### data['order_header_condition_paiement_id'] = ", data['order_header_condition_paiement_id'])
|
||||
|
||||
order_header_condition_paiement_code = ""
|
||||
if ("order_header_condition_paiement_code" in diction.keys()):
|
||||
|
|
@ -5975,7 +6094,23 @@ def Update_Partner_Draft_Invoice(diction):
|
|||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères ", False
|
||||
data['order_header_condition_paiement_code'] = order_header_condition_paiement_code
|
||||
|
||||
print("### data['order_header_condition_paiement_code'] = ", data['order_header_condition_paiement_code'])
|
||||
"""
|
||||
Verifier la validité du vendeur
|
||||
"""
|
||||
if ("order_header_vendeur_id" in diction.keys() and diction['order_header_vendeur_id']):
|
||||
is_valide_vendeur_id = MYSY_GV.dbname['ressource_humaine'].count_documents(
|
||||
{'_id': ObjectId(str(diction['order_header_vendeur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
if (is_valide_vendeur_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du vendeur est invalide ")
|
||||
|
||||
return False, " L'identifiant du vendeur est invalide ", False
|
||||
|
||||
data['order_header_vendeur_id'] = diction['order_header_vendeur_id']
|
||||
|
||||
|
||||
order_header_inclus_bpf = ""
|
||||
|
|
@ -5988,7 +6123,7 @@ def Update_Partner_Draft_Invoice(diction):
|
|||
3]) + " - Le champ 'inclus BPF' n'est pas valide ")
|
||||
|
||||
return False, " -Le champ 'inclus BPF' n'est pas valide ", False
|
||||
data['order_header_inclus_bpf'] = order_header_inclus_bpf
|
||||
data['order_header_inclus_bpf'] = order_header_inclus_bpf
|
||||
|
||||
order_header_ref_client = ""
|
||||
if ("order_header_ref_client" in diction.keys()):
|
||||
|
|
@ -6386,7 +6521,7 @@ def Delete_Partner_Draft_Invoice(diction):
|
|||
|
||||
print(" ### Update_partner_order data = ", data)
|
||||
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_header'].delete(
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_header'].delete_one(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'locked': '0', 'status': '0',
|
||||
'_id': ObjectId(str(invoice_header_id))},
|
||||
|
|
@ -6399,9 +6534,9 @@ def Delete_Partner_Draft_Invoice(diction):
|
|||
return False, "Impossible de mettre à jour l'entête de facture "
|
||||
|
||||
"""
|
||||
Annuler les ignes aussi
|
||||
supprimer les lignes aussi
|
||||
"""
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_header'].delete(
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_header'].delete_many(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'locked': '0', 'status': '0',
|
||||
'invoice_header_id': str(invoice_header_id)}
|
||||
|
|
@ -6713,9 +6848,14 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
if ("invoice_line_id" in diction.keys() and len(str(diction['invoice_line_id'])) > 0 ) :
|
||||
# il s'agit de mettre à jour la ligne. Il faut verifier que la ligne existe et est modifiable
|
||||
invoice_line_id = diction['invoice_line_id']
|
||||
existe_invoice_line_count = MYSY_GV.dbname['partner_order_line'].count_documents({'_id':ObjectId(str(invoice_line_id)), 'valide':'1', 'locked':'0',
|
||||
|
||||
|
||||
|
||||
existe_invoice_line_count = MYSY_GV.dbname['partner_invoice_line'].count_documents({'_id':ObjectId(str(invoice_line_id)), 'valide':'1', 'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
if( existe_invoice_line_count != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La ligne à mettre à jour est invalide")
|
||||
|
|
@ -6723,6 +6863,7 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
|
||||
data['update_date'] = str(datetime.now())
|
||||
data['update_by'] = str(my_partner['_id'])
|
||||
data['invoice_line_type'] = "brouillon"
|
||||
data['status'] = "0"
|
||||
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_line'].find_one_and_update(
|
||||
|
|
@ -6747,6 +6888,7 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
local_update_data['update_date'] = str(datetime.now())
|
||||
local_update_data['update_by'] = str(my_partner['_id'])
|
||||
local_update_data['status'] = "0"
|
||||
local_update_data['invoice_header_type'] = "brouillon"
|
||||
|
||||
upadate_header = MYSY_GV.dbname['partner_invoice_header'].find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['invoice_header_id'])), 'valide': '1', 'locked': '0',
|
||||
|
|
@ -6760,8 +6902,9 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
local_update_data['update_date'] = str(datetime.now())
|
||||
local_update_data['update_by'] = str(my_partner['_id'])
|
||||
local_update_data['status'] = "0"
|
||||
local_update_data['invoice_line_type'] = "brouillon"
|
||||
|
||||
upadate_line = MYSY_GV.dbname['partner_order_line'].find_one_and_update(
|
||||
upadate_line = MYSY_GV.dbname['partner_invoice_line'].find_one_and_update(
|
||||
{'invoice_header_id': str(diction['invoice_header_id']), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])},
|
||||
{"$set": local_update_data},
|
||||
|
|
@ -6789,6 +6932,7 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
data['partner_owner_recid'] = my_partner['recid']
|
||||
data['creation_by'] = str(my_partner['_id'])
|
||||
data['creation_date'] = str(datetime.now())
|
||||
data['invoice_line_type'] = "brouillon"
|
||||
|
||||
if( "tab_inscription_ids_json" in data.keys()):
|
||||
del data['tab_inscription_ids_json']
|
||||
|
|
@ -6811,6 +6955,7 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
local_update_data['update_date'] = str(datetime.now())
|
||||
local_update_data['update_by'] = str(my_partner['_id'])
|
||||
local_update_data['status'] = "0"
|
||||
data['invoice_header_type'] = "brouillon"
|
||||
|
||||
upadate_header = MYSY_GV.dbname['partner_invoice_header'].find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['invoice_header_id'])), 'valide': '1', 'locked': '0',
|
||||
|
|
@ -6827,6 +6972,7 @@ def Add_Update_Partner_Draft_Invoice_Line(diction):
|
|||
local_update_data['update_date'] = str(datetime.now())
|
||||
local_update_data['update_by'] = str(my_partner['_id'])
|
||||
local_update_data['status'] = "0"
|
||||
data['invoice_line_type'] = "brouillon"
|
||||
|
||||
upadate_line = MYSY_GV.dbname['partner_order_line'].find_one_and_update(
|
||||
{'invoice_header_id': str(diction['invoice_header_id']), 'valide': '1', 'locked': '0',
|
||||
|
|
@ -6966,14 +7112,22 @@ def Delete_Partner_Draft_Invoice_Line(diction):
|
|||
|
||||
|
||||
|
||||
my_invoice_line_data_count = MYSY_GV.dbname['partner_invoice_header'].find_one(
|
||||
if (my_invoice_line_data_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de la ligne de facture est invalide ")
|
||||
return False, " L'identifiant de la ligne de facture est invalide ",
|
||||
|
||||
|
||||
my_invoice_line_data = MYSY_GV.dbname['partner_invoice_line'].find_one(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'_id': ObjectId(str(diction['partner_invoice_line']))})
|
||||
|
||||
invoice_line_to_delete_id = str(my_invoice_line_data['_id'])
|
||||
invoice_line_to_delete_invoice_header_ref = str(my_invoice_line_data['order_line_formation'])
|
||||
|
||||
|
||||
|
||||
invoice_line_to_delete_id = str(my_invoice_line_data_count['_id'])
|
||||
invoice_line_to_delete_invoice_header_ref = str(my_invoice_line_data_count['order_line_formation'])
|
||||
|
||||
### 1 - Mise à jour de l'entete
|
||||
now = str(datetime.now())
|
||||
|
|
@ -6982,9 +7136,8 @@ def Delete_Partner_Draft_Invoice_Line(diction):
|
|||
data['update_date'] = now
|
||||
data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
print(" ### Update_partner_order data = ", data)
|
||||
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_line'].delete(
|
||||
inserted_data = MYSY_GV.dbname['partner_invoice_line'].delete_one(
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'locked': '0',
|
||||
'_id': ObjectId(str(diction['partner_invoice_line']))},
|
||||
|
|
@ -7489,3 +7642,139 @@ def Compute_Invoice_Header(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de génerer les calculs de mise à jour "
|
||||
|
||||
|
||||
"""
|
||||
Récuprer toutes les factures qui concernent un inscrit
|
||||
"""
|
||||
def Get_Given_Inscrit_Invoices(diction):
|
||||
try:
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'inscription_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'inscription_id']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de l'inscription
|
||||
"""
|
||||
is_valid_inscription = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(diction['inscription_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if(is_valid_inscription != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscription est invalide ")
|
||||
return False, " L'identifiant de l'inscription est invalide "
|
||||
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one(
|
||||
{'_id': ObjectId(str(diction['inscription_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
total_frais_inscription = 0
|
||||
if( "price" in inscription_data.keys()):
|
||||
total_frais_inscription = mycommon.tryFloat(str(inscription_data['price']))
|
||||
|
||||
reste_a_facturer = 0
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['order_line_inscription_id'] = str(diction['inscription_id'])
|
||||
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
tab_detail_facture = []
|
||||
total_fature = 0
|
||||
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_invoice_line_detail'].find(data_cle):
|
||||
|
||||
"""
|
||||
Recuperer les données d'entete de facture
|
||||
"""
|
||||
|
||||
|
||||
invoice_header_data = MYSY_GV.dbname['partner_invoice_header'].find_one({'_id':ObjectId(str(retval['invoice_header_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( invoice_header_data ):
|
||||
local_node = {}
|
||||
local_node['invoice_header_ref_interne'] = invoice_header_data['invoice_header_ref_interne']
|
||||
local_node['invoice_date'] = invoice_header_data['invoice_date']
|
||||
local_node['total_header_hors_taxe_before_header_reduction'] = invoice_header_data['total_header_hors_taxe_before_header_reduction']
|
||||
local_node['order_header_tax_amount'] = invoice_header_data['order_header_tax_amount']
|
||||
local_node['total_header_toutes_taxes'] = invoice_header_data['total_header_toutes_taxes']
|
||||
|
||||
local_node['order_line_prix_unitaire'] = retval['order_line_prix_unitaire']
|
||||
local_node['order_line_qty'] = retval['order_line_qty']
|
||||
local_node['order_line_montant_hors_taxes'] = retval['order_line_montant_hors_taxes']
|
||||
local_node['inscription_id'] = diction['inscription_id']
|
||||
|
||||
total_fature = total_fature + float(retval['order_line_montant_hors_taxes'])
|
||||
tab_detail_facture.append(local_node)
|
||||
|
||||
|
||||
|
||||
|
||||
final_data = {}
|
||||
final_data['liste_facture'] = tab_detail_facture
|
||||
final_data['total_facture_line'] = str(round(total_fature, 2))
|
||||
|
||||
reste_a_facturer = round(float(total_frais_inscription) - float(total_fature), 2)
|
||||
|
||||
final_data['reste_a_facturer'] = str(reste_a_facturer)
|
||||
final_data['frais_inscription'] = str(total_frais_inscription)
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(final_data))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les données de facture "
|
||||
|
|
|
|||
|
|
@ -630,7 +630,8 @@ def update_partner_account(file_logo=None, file_cachet=None, Folder=None, dictio
|
|||
'invoice_adr_country', 'invoice_email', 'invoice_telephone',
|
||||
'siret', 'num_nda', 'iscertitrace', 'isdatadock', 'isqualiopi', 'website',
|
||||
'isbureaucertitrace', 'iscertifvoltaire', 'file_logo_recid', 'file_cachet_recid',
|
||||
'partner_account_id', 'invoice_taux_vat', 'subdomaine_catalog_pub', ]
|
||||
'partner_account_id', 'invoice_taux_vat', 'subdomaine_catalog_pub', 'file_cachet',
|
||||
'file_cachet_recid', 'file_logo', 'file_logo_recid']
|
||||
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
|
|
|||
Loading…
Reference in New Issue