25/02/2024 - 18h30
parent
5880c38a3d
commit
c270d11960
|
@ -1,15 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/02/2024 - 22h30">
|
||||
<change afterPath="$PROJECT_DIR$/paiement_condition.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="24/02/2024 - 22h30">
|
||||
<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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.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_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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -79,13 +75,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00177" summary="18/12/2023 - 22:00">
|
||||
<created>1702933100879</created>
|
||||
<option name="number" value="00177" />
|
||||
<option name="presentableId" value="LOCAL-00177" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1702933100880</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00178" summary="20/12/2023 - 18h">
|
||||
<created>1703092066442</created>
|
||||
<option name="number" value="00178" />
|
||||
|
@ -422,7 +411,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1708724600233</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="226" />
|
||||
<task id="LOCAL-00226" summary="24/02/2024 - 22h30">
|
||||
<created>1708808985842</created>
|
||||
<option name="number" value="00226" />
|
||||
<option name="presentableId" value="LOCAL-00226" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1708808985842</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="227" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -437,7 +433,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="24/01/2024 -12h00" />
|
||||
<MESSAGE value="rrr" />
|
||||
<MESSAGE value="rrrf" />
|
||||
<MESSAGE value="29/01/24 - 21h30" />
|
||||
|
@ -462,6 +457,7 @@
|
|||
<MESSAGE value="dd" />
|
||||
<MESSAGE value="ddr" />
|
||||
<MESSAGE value="23/02/2024 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="23/02/2024 - 22h30" />
|
||||
<MESSAGE value="24/02/2024 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="24/02/2024 - 22h30" />
|
||||
</component>
|
||||
</project>
|
1545
Log/log_file.log
1545
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -6902,6 +6902,20 @@ Sur une session :
|
|||
- Cas particulier :
|
||||
- un participant qui est en autonome (donc pas de client )
|
||||
- pour le facturer il faudra obligatoirement créer une client.
|
||||
|
||||
/!\ : On ajoute un champ 'invoiced' à chaque ligne.
|
||||
ainsi si une lignes est déjà invoiced, alors on ne la refacture pas.
|
||||
|
||||
/!\ : Pour les inscrit sans client_rattachement_id, voici comment on procede :
|
||||
1 - on verifier s'il y a un client avec la meme adresse email, si oui on recupere l'id du client
|
||||
qu'on vient mettre sur l'inscription.
|
||||
|
||||
2 - si aucun client avec cette adresse email, on va créer un client de type 'particulier' et
|
||||
on vient mettre à jour inscription.
|
||||
|
||||
Infiné, apres la facturation, toutes les lignes d'inscription on bel et bien un 'client_rattachement_id'
|
||||
|
||||
|
||||
"""
|
||||
def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
||||
try:
|
||||
|
@ -6936,6 +6950,138 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide ", False
|
||||
|
||||
"""
|
||||
Gestion des inscriptions n'ayant pas de client 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']),
|
||||
"client_rattachement_id": '',
|
||||
"invoiced": {'$ne': '1'}
|
||||
},
|
||||
{'session_id': str(diction['session_id']),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'client_rattachement_id': {'$exists': False},
|
||||
"invoiced": {'$ne': '1'}
|
||||
}]
|
||||
}
|
||||
)
|
||||
|
||||
# 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)
|
||||
|
||||
"""
|
||||
- Verifier s'il y a un client avec la même adresse email,
|
||||
si non, créer le client
|
||||
"""
|
||||
is_inscription_no_client_exist = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email'])})
|
||||
|
||||
# S'il ya plusieurs clients avec la meme adresse email, alors il y a un bin's
|
||||
if (is_inscription_no_client_exist > 1):
|
||||
mycommon.myprint(" Facturation : L'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " correspond à plusieurs clients")
|
||||
return False, " Facturation : L'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " correspond à plusieurs clients ", False
|
||||
|
||||
# Si le client existe, verifier qu'il est valide et pas locké
|
||||
if (is_inscription_no_client_exist == 1):
|
||||
is_inscription_no_client_valide_no_locked = MYSY_GV.dbname['partner_client'].count_documents(
|
||||
{'partner_recid': str(my_partner['recid']),
|
||||
'email': str(local_inscription_no_client['email']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
||||
if (is_inscription_no_client_valide_no_locked == 0):
|
||||
mycommon.myprint(" Facturation : L'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " correspond à un client non valide")
|
||||
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
|
||||
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']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
||||
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'])}})
|
||||
|
||||
# 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):
|
||||
new_client_data = {}
|
||||
new_partner_all_list = ['token', "raison_sociale", "nom", "siret", "tva", "email",
|
||||
"telephone", "website", "comment", "address",
|
||||
'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_pays',
|
||||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_client']
|
||||
|
||||
# Pre Remplir les champs à vide
|
||||
for tmp in new_partner_all_list:
|
||||
new_client_data[str(tmp)] = ""
|
||||
|
||||
|
||||
new_client_data['token'] = diction['token']
|
||||
|
||||
if ("nom" in local_inscription_no_client.keys()):
|
||||
new_client_data['raison_sociale'] = local_inscription_no_client['nom']
|
||||
new_client_data['nom'] = local_inscription_no_client['nom']
|
||||
|
||||
if( "email" in local_inscription_no_client.keys() ):
|
||||
new_client_data['email'] = local_inscription_no_client['email']
|
||||
new_client_data['invoice_email'] = local_inscription_no_client['email']
|
||||
|
||||
if ("telephone" in local_inscription_no_client.keys()):
|
||||
new_client_data['telephone'] = local_inscription_no_client['telephone']
|
||||
|
||||
if ("adresse" in local_inscription_no_client.keys()):
|
||||
new_client_data['adr_adresse'] = local_inscription_no_client['adresse']
|
||||
#new_client_data['invoice_adresse'] = local_inscription_no_client['adresse']
|
||||
|
||||
if("code_postal" in local_inscription_no_client.keys()):
|
||||
new_client_data['adr_code_postal'] = local_inscription_no_client['code_postal']
|
||||
new_client_data['invoice_code_postal'] = local_inscription_no_client['code_postal']
|
||||
|
||||
if ("ville" in local_inscription_no_client.keys()):
|
||||
new_client_data['adr_ville'] = local_inscription_no_client['ville']
|
||||
new_client_data['invoice_ville'] = local_inscription_no_client['ville']
|
||||
|
||||
if ("pays" in local_inscription_no_client.keys()):
|
||||
new_client_data['adr_pays'] = local_inscription_no_client['pays']
|
||||
new_client_data['invoice_pays'] = local_inscription_no_client['pays']
|
||||
|
||||
|
||||
new_client_data['is_client'] = "1"
|
||||
new_client_data['is_client'] = "0"
|
||||
|
||||
new_client_status, new_client_retval = partner_client.Add_Partner_Client(new_client_data)
|
||||
if (new_client_status is False):
|
||||
mycommon.myprint(" Facturation : Impossible de créer un client associé à l'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " ")
|
||||
return False, " Facturation : Impossible de créer un client associé à l'adresse email : " + str(
|
||||
local_inscription_no_client['email']) + " ", False
|
||||
|
||||
# Mise à jour de l'inscription avec l'_id du client
|
||||
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']),
|
||||
'valide': "1",
|
||||
'locked': '0'})
|
||||
|
||||
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'])}})
|
||||
|
||||
|
||||
# Verifier qu'il ya bien des inscriptions valides dans la session pour le client
|
||||
liste_client_rattachement_id = MYSY_GV.dbname['inscription'].distinct("client_rattachement_id",
|
||||
|
@ -6943,7 +7089,8 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
'status': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
"client_rattachement_id": { '$ne': ''}
|
||||
"client_rattachement_id": { '$ne': ''},
|
||||
"invoiced": {'$ne': '1'}
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -6970,9 +7117,11 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
)
|
||||
|
||||
# Envoie des conventions pour les inscrits AVEC client_id (conventions d'entreprise)
|
||||
|
||||
tab_local_invoice_ref_interne = []
|
||||
# Envoie des factures pour les inscrits AVEC client_id (conventions d'entreprise)
|
||||
for single_client in liste_client_rattachement_id:
|
||||
print(" Traintement du client_id = ", single_client)
|
||||
print(" Traitement du client_id = ", single_client)
|
||||
|
||||
# Recuperation des contacts de communication du client
|
||||
local_diction = {}
|
||||
|
@ -7017,17 +7166,24 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
if( local_create_invoice_status is False ):
|
||||
return local_create_invoice_status, local_create_invoice_retval, False
|
||||
|
||||
"""
|
||||
local_status, local_retval = Sent_Facture_Stagiaire_By_Email_By_Partner_client(tab_saved_file_full_path, Folder, new_diction_client)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(" WARNING : impossible d'envoyer la convention au client : " + str(single_client))
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Mettre à jour les lignes associées à ce client pour dire que la ligne est facturé
|
||||
"""
|
||||
|
||||
update = MYSY_GV.dbname['inscription'].update_many({'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':diction['session_id'],
|
||||
'client_rattachement_id':str(single_client)},
|
||||
{'$set':{'invoiced':'1'}})
|
||||
|
||||
|
||||
return True, " Les Factures ont été correctement créées et envoyées par emails", local_invoice_ref_interne
|
||||
tab_local_invoice_ref_interne.append(str(local_invoice_ref_interne))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return True, " Les Factures ont été correctement créées et envoyées par emails", tab_local_invoice_ref_interne
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
@ -7282,6 +7438,7 @@ def Invoice_Partner_From_Session( diction):
|
|||
partner_invoice_header_data['valide'] = "1"
|
||||
partner_invoice_header_data['locked'] = "0"
|
||||
partner_invoice_header_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
partner_invoice_header_data['date_update'] = str(datetime.now())
|
||||
|
||||
|
||||
print(" #### partner_invoice_header_data = ", partner_invoice_header_data)
|
||||
|
@ -7362,6 +7519,7 @@ def Invoice_Partner_From_Session( diction):
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Envoie par email pour les stagiaires rattachés à un client
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ def Add_Partner_Client(diction):
|
|||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur']
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company']
|
||||
|
||||
print(" diction = ", diction)
|
||||
|
||||
|
@ -145,6 +145,13 @@ def Add_Partner_Client(diction):
|
|||
client_type_id = diction['client_type_id']
|
||||
data['client_type_id'] = client_type_id
|
||||
|
||||
is_company = "0"
|
||||
if ("is_company" in diction.keys()):
|
||||
if diction['is_company']:
|
||||
is_company = diction['is_company']
|
||||
data['is_company'] = is_company
|
||||
|
||||
|
||||
is_fournisseur = ""
|
||||
if ("is_fournisseur" in diction.keys() and diction['is_fournisseur']):
|
||||
if (str(diction['is_fournisseur']) not in ['0', '1']):
|
||||
|
@ -510,7 +517,7 @@ def Update_Partner_Client(diction):
|
|||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva','invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', 'client_type_id',
|
||||
'is_fournisseur', 'is_client', 'is_financeur']
|
||||
'is_fournisseur', 'is_client', 'is_financeur', 'is_company']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -577,6 +584,15 @@ def Update_Partner_Client(diction):
|
|||
raison_sociale = diction['raison_sociale']
|
||||
data_update['raison_sociale'] = diction['raison_sociale']
|
||||
|
||||
is_company = "0"
|
||||
if ("is_company" in diction.keys()):
|
||||
is_company = diction['is_company']
|
||||
if( is_company in ['0', '1']):
|
||||
data_update['is_company'] = is_company
|
||||
else:
|
||||
data_update['is_company'] = "0"
|
||||
|
||||
|
||||
nom = ""
|
||||
if ("nom" in diction.keys()):
|
||||
nom = diction['nom']
|
||||
|
|
Loading…
Reference in New Issue