25/02/2024 - 22h30
parent
c270d11960
commit
0055ac0ff8
|
@ -3,6 +3,7 @@
|
|||
<component name="ChangeListManager">
|
||||
<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$/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$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
|
|
|
@ -1318,6 +1318,21 @@ def GetAllClassStagiaire(diction):
|
|||
user['financeur_rattachement_id'] = financeur_rattachement_id
|
||||
user['financeur_rattachement_nom'] = financeur_rattachement_nom
|
||||
|
||||
invoiced = ""
|
||||
if( "invoiced" in retval.keys() ):
|
||||
invoiced = retval['invoiced']
|
||||
user['invoiced'] = invoiced
|
||||
|
||||
invoiced_ref = ""
|
||||
if ("invoiced_ref" in retval.keys()):
|
||||
invoiced_ref = retval['invoiced_ref']
|
||||
user['invoiced_ref'] = invoiced_ref
|
||||
|
||||
invoiced_date = ""
|
||||
if ("invoiced_date" in retval.keys()):
|
||||
invoiced_date = str(retval['invoiced_date'])[0:10]
|
||||
user['invoiced_date'] = invoiced_date
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -6469,6 +6484,23 @@ def Get_Statgaire_List_Partner_with_filter(diction):
|
|||
val['client_rattachement_nom'] = client_rattachement_nom
|
||||
|
||||
# ----
|
||||
|
||||
invoiced = ""
|
||||
if ("invoiced" in retVal.keys()):
|
||||
invoiced = retVal['invoiced']
|
||||
val['invoiced'] = invoiced
|
||||
|
||||
invoiced_ref = ""
|
||||
if ("invoiced_ref" in retVal.keys()):
|
||||
invoiced_ref = retVal['invoiced_ref']
|
||||
val['invoiced_ref'] = invoiced_ref
|
||||
|
||||
invoiced_date = ""
|
||||
if ("invoiced_date" in retVal.keys()):
|
||||
invoiced_date = str(retVal['invoiced_date'])[0:10]
|
||||
val['invoiced_date'] = invoiced_date
|
||||
|
||||
|
||||
financeur_rattachement_id = ""
|
||||
financeur_rattachement_nom = ""
|
||||
|
||||
|
|
1130
Log/log_file.log
1130
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,7 @@ from datetime import datetime, date
|
|||
|
||||
from xhtml2pdf import pisa
|
||||
|
||||
import Contact
|
||||
import Session_Formation_Sequence
|
||||
import attached_file_mgt
|
||||
import module_editique
|
||||
|
@ -7016,6 +7017,8 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
|
||||
# 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_contact_data = {}
|
||||
new_client_data = {}
|
||||
new_partner_all_list = ['token', "raison_sociale", "nom", "siret", "tva", "email",
|
||||
"telephone", "website", "comment", "address",
|
||||
|
@ -7031,37 +7034,70 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
|
||||
|
||||
new_client_data['token'] = diction['token']
|
||||
new_client_contact_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']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['nom'] = local_inscription_no_client['nom']
|
||||
|
||||
if ("prenom" in local_inscription_no_client.keys()):
|
||||
# Pour le contact
|
||||
new_client_contact_data['prenom'] = local_inscription_no_client['prenom']
|
||||
|
||||
if ("civilite" in local_inscription_no_client.keys()):
|
||||
# Pour le contact
|
||||
new_client_contact_data['civilite'] = local_inscription_no_client['civilite']
|
||||
|
||||
|
||||
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']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['email'] = local_inscription_no_client['email']
|
||||
|
||||
if ("telephone" in local_inscription_no_client.keys()):
|
||||
new_client_data['telephone'] = local_inscription_no_client['telephone']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_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']
|
||||
new_client_data['invoice_adresse'] = local_inscription_no_client['adresse']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['adr_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']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['adr_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']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['adr_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']
|
||||
|
||||
# Pour le contact
|
||||
new_client_contact_data['adr_pays'] = local_inscription_no_client['pays']
|
||||
|
||||
|
||||
new_client_data['is_client'] = "1"
|
||||
new_client_data['is_client'] = "0"
|
||||
new_client_data['is_company'] = "0"
|
||||
|
||||
|
||||
new_client_status, new_client_retval = partner_client.Add_Partner_Client(new_client_data)
|
||||
if (new_client_status is False):
|
||||
|
@ -7070,13 +7106,23 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
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'})
|
||||
|
||||
# Créer le contact de communication du client
|
||||
new_client_contact_data['include_com'] = "1"
|
||||
new_client_contact_data['related_collection'] = "partner_client"
|
||||
new_client_contact_data['related_collection_owner_id'] = str(inscription_no_client_valide_no_locked_data['_id'])
|
||||
local_add_contact_status, local_add_contact_retval = Contact.Add_Contact(new_client_contact_data)
|
||||
if( local_add_contact_status is False ):
|
||||
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
|
||||
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(
|
||||
|
@ -7170,20 +7216,29 @@ def Prepare_and_Send_Facture_From_Session_By_Email(tab_files, Folder, diction):
|
|||
"""
|
||||
Mettre à jour les lignes associées à ce client pour dire que la ligne est facturé
|
||||
"""
|
||||
now = str(datetime.now())
|
||||
update_data = {}
|
||||
update_data['invoiced'] = "1"
|
||||
update_data['invoiced_ref'] = str(local_invoice_ref_interne)
|
||||
update_data['invoiced_date'] = now
|
||||
update_data['date_update'] = now
|
||||
update_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
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'}})
|
||||
{'$set':update_data})
|
||||
|
||||
|
||||
tab_local_invoice_ref_interne.append(str(local_invoice_ref_interne))
|
||||
|
||||
|
||||
|
||||
return_message = " La session a été correctement facturée.\nListe des factures : "
|
||||
for tmp in tab_local_invoice_ref_interne:
|
||||
return_message += "\n - "+str(tmp)
|
||||
|
||||
|
||||
return True, " Les Factures ont été correctement créées et envoyées par emails", tab_local_invoice_ref_interne
|
||||
return True, str(return_message), tab_local_invoice_ref_interne
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
|
@ -36,7 +36,7 @@ def Add_Partner_Client(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "raison_sociale", "nom", "siret", "tva", "email",
|
||||
"telephone", "website", "comment", "address", "invoice_address", "list_contact",
|
||||
"telephone", "website", "comment", "address", "list_contact",
|
||||
'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',
|
||||
|
@ -337,23 +337,6 @@ def Add_Partner_Client(diction):
|
|||
|
||||
|
||||
|
||||
invoice_address = {}
|
||||
if ("invoice_address" in diction.keys()):
|
||||
if diction['invoice_address']:
|
||||
invoice_address = ast.literal_eval(diction['invoice_address'])
|
||||
data['invoice_address'] = ast.literal_eval(diction['invoice_address'])
|
||||
|
||||
""""
|
||||
verification que le ligne "adresse de facturation" contient bien les champs :
|
||||
- adresse, code postal, ville, pays
|
||||
"""
|
||||
|
||||
adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ]
|
||||
for val in adresse_field_list_obligatoire:
|
||||
if val not in invoice_address.keys():
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse de facturation")
|
||||
return False, " Le champ '" + val + "' est obligatoire dans l'adresse de facturation",
|
||||
|
||||
list_contact = ""
|
||||
if ("list_contact" in diction.keys()):
|
||||
|
@ -512,7 +495,7 @@ def Update_Partner_Client(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "_id", "raison_sociale", "nom", "siret", "tva", "email",
|
||||
"telephone", "website", "comment", "address", "invoice_address", "list_contact",
|
||||
"telephone", "website", "comment", "address", "list_contact",
|
||||
'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',
|
||||
|
@ -779,24 +762,6 @@ def Update_Partner_Client(diction):
|
|||
str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse")
|
||||
return False, " Le champ '" + val + "' est obligatoire dans l'adresse",
|
||||
|
||||
invoice_address = {}
|
||||
if ("invoice_address" in diction.keys()):
|
||||
invoice_address = ast.literal_eval(diction['invoice_address'])
|
||||
data_update['invoice_address'] = ast.literal_eval(diction['invoice_address'])
|
||||
|
||||
""""
|
||||
verification que le ligne "adresse de facturation" contient bien les champs :
|
||||
- adresse, code postal, ville, pays
|
||||
"""
|
||||
|
||||
adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ]
|
||||
for val in adresse_field_list_obligatoire:
|
||||
if val not in invoice_address.keys():
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse de facturation")
|
||||
return False, " Le champ '" + val + "' est obligatoire dans l'adresse de facturation",
|
||||
|
||||
list_contact = ""
|
||||
if ("list_contact" in diction.keys()):
|
||||
list_contact = diction['list_contact']
|
||||
|
|
Loading…
Reference in New Issue