master
cherif 2024-05-16 13:03:31 +02:00
parent d9ab890394
commit 3d5e6764fd
8 changed files with 3542 additions and 43 deletions

View File

@ -1,12 +1,15 @@
<?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="sds">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="sdsdd">
<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$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -76,13 +79,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00251" summary="fff">
<created>1711656774534</created>
<option name="number" value="00251" />
<option name="presentableId" value="LOCAL-00251" />
<option name="project" value="LOCAL" />
<updated>1711656774535</updated>
</task>
<task id="LOCAL-00252" summary="01/04/24 - 23h30">
<created>1712006756164</created>
<option name="number" value="00252" />
@ -419,7 +415,14 @@
<option name="project" value="LOCAL" />
<updated>1715795512375</updated>
</task>
<option name="localTasksCounter" value="300" />
<task id="LOCAL-00300" summary="sdsdd">
<created>1715805416758</created>
<option name="number" value="00300" />
<option name="presentableId" value="LOCAL-00300" />
<option name="project" value="LOCAL" />
<updated>1715805416759</updated>
</task>
<option name="localTasksCounter" value="301" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -461,7 +464,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="20/04/2024 - 20h44" />
<MESSAGE value="22/04/2024 - 17h30" />
<MESSAGE value="23/04/2024 - 14h06" />
<MESSAGE value="25/04/2024 - 19h" />
@ -486,6 +488,7 @@
<MESSAGE value="13/05/2024 - 18h30" />
<MESSAGE value="14/05/2024 - 21h30" />
<MESSAGE value="sds" />
<option name="LAST_COMMIT_MESSAGE" value="sds" />
<MESSAGE value="sdsdd" />
<option name="LAST_COMMIT_MESSAGE" value="sdsdd" />
</component>
</project>

View File

@ -74,7 +74,8 @@ def AddStagiairetoClass(diction):
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com','date_naissance',
'financeur_rattachement_id', 'tuteur1_civilite', 'tuteur1_civilite', 'quotation_id'
'financeur_rattachement_id', 'tuteur1_civilite', 'tuteur1_civilite', 'quotation_id',
'facture_client_rattachement_id'
]
incom_keys = diction.keys()
@ -272,6 +273,26 @@ def AddStagiairetoClass(diction):
else:
mydata['client_rattachement_id'] = ""
if ("facture_client_rattachement_id" in diction.keys()):
if diction['facture_client_rattachement_id']:
mydata['facture_client_rattachement_id'] = diction['facture_client_rattachement_id']
## Verifier l'existance du client de rattachement
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents( {'_id': ObjectId(diction['facture_client_rattachement_id']),
'valide': '1','locked': '0', 'partner_recid': str(my_session_data['partner_owner_recid'])})
if( local_client_retval_count != 1 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " - L'entité à facturer est invalide : local_client_retval_count = "+ str(local_client_retval_count))
return False, " L'entité à facturer est invalide "
else:
mydata['facture_client_rattachement_id'] = ""
if ("financeur_rattachement_id" in diction.keys()):
if diction['financeur_rattachement_id']:
mydata['financeur_rattachement_id'] = diction['financeur_rattachement_id']
@ -642,7 +663,7 @@ def UpdateStagiairetoClass(diction):
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com', 'type_apprenant', 'civilite',
'date_naissance', 'financeur_rattachement_id'
'date_naissance', 'financeur_rattachement_id', 'facture_client_rattachement_id'
]
incom_keys = diction.keys()
@ -881,6 +902,22 @@ def UpdateStagiairetoClass(diction):
3]) + " - Le client de rattachement est invalide : local_client_retval_count = "+str(local_client_retval_count))
return False, " Le client de rattachement est invalide "
if ("facture_client_rattachement_id" in diction.keys()):
mydata['facture_client_rattachement_id'] = str(diction['facture_client_rattachement_id']).strip()
if(len(str(diction['facture_client_rattachement_id']).strip()) > 0 ):
## Verifier l'existance du client de rattachement
local_client_retval_count = MYSY_GV.dbname['partner_client'].count_documents({'_id': ObjectId(diction['facture_client_rattachement_id']),
'valide': '1', 'locked': '0', 'partner_recid': str(partner_recid)})
if (local_client_retval_count != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'entité à facturer est invalide : local_client_retval_count = "+str(local_client_retval_count))
return False, "L'entité à facturer est invalide "
if ("financeur_rattachement_id" in diction.keys()):
mydata['financeur_rattachement_id'] = str(diction['financeur_rattachement_id']).strip()
if (len(str(diction['financeur_rattachement_id']).strip()) > 0):
@ -7199,7 +7236,11 @@ def GetAttendeeDetail_perSession_from_line_id(diction):
my_retrun_dict['financeur_rattachement_id'] = financeur_rattachement_id
my_retrun_dict['financeur_rattachement_nom'] = financeur_rattachement_nom
if ("facture_client_rattachement_id" in local_Insc_retval.keys()):
my_retrun_dict['facture_client_rattachement_id'] = local_Insc_retval[
'facture_client_rattachement_id']
else:
my_retrun_dict['facture_client_rattachement_id'] = ""
v = local_Insc_retval['_id'].generation_time
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))

File diff suppressed because it is too large Load Diff

View File

@ -5928,8 +5928,8 @@ def Create_Automatic_Quotation():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Create_Automatic_Quotation payload = ", str(payload))
status, message = partner_order.Create_Automatic_Quotation(payload)
return jsonify(status=status, message=message)
status, message, quotation_ref = partner_order.Create_Automatic_Quotation(payload)
return jsonify(status=status, message=message, quotation_ref=quotation_ref)

View File

@ -267,10 +267,7 @@ def Get_List_Partner_Basic_Setup(diction):
RetObject = []
val_tmp = 1
qry = {'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',
'related_collection':str(diction['related_collection'])}
print(" ### qry = ", qry)
for New_retVal in MYSY_GV.dbname['base_partner_setup'].find({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',

View File

@ -1240,6 +1240,9 @@ def Get_Partner_List_Partner_Client(diction):
if( "invoice_condition_paiement_id" not in retval.keys() ):
user['invoice_condition_paiement_id'] = ""
if ("is_prospect" not in retval.keys()):
user['is_prospect'] = ""
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -1350,6 +1353,19 @@ def Get_Partner_List_Partner_Client_with_filter_Like(diction):
user = New_retVal
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("is_financeur" not in New_retVal.keys()):
user['is_financeur'] = 0
if ("is_client" not in New_retVal.keys()):
user['is_client'] = 0
if ("is_fournisseur" not in New_retVal.keys()):
user['is_fournisseur'] = 0
if( "is_prospect" not in New_retVal.keys() ):
user['is_prospect'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -1920,6 +1936,9 @@ def Get_Client_Type_List(diction):
if ("is_fournisseur" not in retval.keys()):
user['is_fournisseur'] = 0
if ("is_prospect" not in retval.keys()):
user['is_prospect'] = ""
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))

View File

@ -4227,40 +4227,40 @@ def Compute_Order_Header(diction):
for local_retval in MYSY_GV.dbname['partner_order_line'].find({'order_header_id':str(diction['_id']), 'valide':'1', 'locked':'0',
'partner_owner_recid':str(my_partner['recid']) }):
print(" ------------------- Pour la ligne numero : ", nb_line)
#print(" ------------------- Pour la ligne numero : ", nb_line)
ligne_montant_reduction = 0
if ("order_line_montant_reduction" in local_retval.keys()):
line_sum_order_line_montant_reduction = line_sum_order_line_montant_reduction + mycommon.tryFloat(
local_retval['order_line_montant_reduction'])
ligne_montant_reduction = mycommon.tryFloat(local_retval['order_line_montant_reduction'])
print(" #### order_line_montant_reduction = ",
str(mycommon.tryFloat(local_retval['order_line_montant_reduction'])))
# print(" #### order_line_montant_reduction = ",
# str(mycommon.tryFloat(local_retval['order_line_montant_reduction'])))
if( "order_line_tax_amount" in local_retval.keys()):
line_sum_order_line_tax_amount = line_sum_order_line_tax_amount + mycommon.tryFloat(local_retval['order_line_tax_amount'])
print(" #### order_line_tax_amount = ", str(mycommon.tryFloat(local_retval['order_line_tax_amount'])))
# print(" #### order_line_tax_amount = ", str(mycommon.tryFloat(local_retval['order_line_tax_amount'])))
if ("order_line_montant_hors_taxes" in local_retval.keys()):
line_sum_order_line_montant_hors_taxes_before_reduction = line_sum_order_line_montant_hors_taxes_before_reduction + mycommon.tryFloat(
local_retval['order_line_montant_hors_taxes'])
print(" #### order_line_montant_hors_taxes = ", str(mycommon.tryFloat(local_retval['order_line_montant_hors_taxes'])))
# print(" #### order_line_montant_hors_taxes = ", str(mycommon.tryFloat(local_retval['order_line_montant_hors_taxes'])))
order_line_montant_hors_taxes_APRES_REDUCTION = mycommon.tryFloat(local_retval['order_line_montant_hors_taxes']) - ligne_montant_reduction
print(" #### order_line_montant_hors_taxes_APRES_REDUCTION = ", str(order_line_montant_hors_taxes_APRES_REDUCTION))
# print(" #### order_line_montant_hors_taxes_APRES_REDUCTION = ", str(order_line_montant_hors_taxes_APRES_REDUCTION))
if ("order_line_montant_toutes_taxes" in local_retval.keys()):
line_sum_order_line_montant_toutes_taxes = line_sum_order_line_montant_toutes_taxes + mycommon.tryFloat(
local_retval['order_line_montant_toutes_taxes'])
print(" #### order_line_montant_toutes_taxes = ",
str(mycommon.tryFloat(local_retval['order_line_montant_toutes_taxes'])))
# print(" #### order_line_montant_toutes_taxes = ",
# str(mycommon.tryFloat(local_retval['order_line_montant_toutes_taxes'])))
print(" ----------- FIN DES LIGNES ")
#print(" ----------- FIN DES LIGNES ")
nb_line = nb_line + 1
@ -6891,7 +6891,7 @@ def Create_Automatic_Quotation(diction):
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"
return False, " Les informations fournies sont incorrectes", False
"""
Verification des champs obligatoires
@ -6902,7 +6902,7 @@ def Create_Automatic_Quotation(diction):
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Les informations fournies sont incorrectes"
return False, " Les informations fournies sont incorrectes", False
@ -6921,7 +6921,8 @@ def Create_Automatic_Quotation(diction):
if( is_valide_lead_website != 1 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du leads est invalide ")
return False, " L'identifiant du leads est invalide "
return False, " L'identifiant du leads est invalide ", False
valide_lead_website_data = MYSY_GV.dbname['lead_website'].find_one({'_id':ObjectId(str(diction['lead_website_id'])),
@ -6948,7 +6949,7 @@ def Create_Automatic_Quotation(diction):
if( is_client_exist_data['locked'] == "1" or is_client_exist_data['valide'] == "0"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ce client est verrouillé, impossible de créer un devis ")
return False, " Ce client est verrouillé, impossible de créer un devis "
return False, " Ce client est verrouillé, impossible de créer un devis ", False
else:
client_connu = "1"
@ -6968,7 +6969,7 @@ def Create_Automatic_Quotation(diction):
local_prospect_status, local_prospect_retval = partner_client.Add_Partner_Prospect(new_client_diction)
if( local_prospect_status is False ):
return local_prospect_status, local_prospect_retval
return local_prospect_status, local_prospect_retval, False
is_client_exist_data = MYSY_GV.dbname['partner_client'].find_one(
{'partner_recid': str(valide_lead_website_data['partner_owner_recid']),
@ -6990,14 +6991,20 @@ def Create_Automatic_Quotation(diction):
new_quotation_header['order_header_status'] = "0"
new_quotation_header['order_lines'] = []
print(" avant creation zzzzz")
"""
Recuperation des données de config pour la relance des devis
"""
for tmp_val in MYSY_GV.dbname['base_partner_setup'].find(
{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0',
'related_collection': 'quotation'}):
new_quotation_header[str(tmp_val['config_name'])] = str(tmp_val['config_value'])
local_create_quotation_status, local_create_quotation_retval, local_create_quotation_ref_interne = Add_Partner_Quotation(
new_quotation_header)
if (local_create_quotation_status is False):
return local_create_quotation_status, local_create_quotation_retval
print(" apres creation yyyy ")
return local_create_quotation_status, local_create_quotation_retval, False
quotation_id = MYSY_GV.dbname['partner_order_header'].find_one({"order_header_ref_interne":str(local_create_quotation_ref_interne),
'partner_owner_recid':str(valide_lead_website_data['partner_owner_recid'])})
@ -7012,11 +7019,11 @@ def Create_Automatic_Quotation(diction):
str(inspect.stack()[0][3]) + " - La valeur '" + str(
my_partner['invoice_taux_vat']) + "' n'est pas un taux de TVA correcte ")
return False, " La valeur '" + str(
my_partner['invoice_taux_vat']) + "' n'est pas un taux de TVA correcte ",
my_partner['invoice_taux_vat']) + "' n'est pas un taux de TVA correcte ", False
partner_taux_tva = IsInt_retval
print(" ### COMPUTE : le taux de TVA = ", str(partner_taux_tva))
#print(" ### COMPUTE : le taux de TVA = ", str(partner_taux_tva))
prix_total_ht = mycommon.tryFloat( str(valide_lead_website_data['nb_person_info'])) * mycommon.tryFloat(str(valide_lead_website_data['class_sales_price']))
line_taxe = (prix_total_ht * partner_taux_tva)/100
@ -7048,7 +7055,8 @@ def Create_Automatic_Quotation(diction):
local_create_quotation_line_status, local_create_quotation_line_retval = Add_Update_Partner_Order_Line(lines_node)
if(local_create_quotation_line_status is False ):
return local_create_quotation_line_status, local_create_quotation_line_retval
return local_create_quotation_line_status, local_create_quotation_line_retval, False
comput_diction = {}
comput_diction['token'] = my_partner['token']
@ -7072,11 +7080,11 @@ def Create_Automatic_Quotation(diction):
MYSY_GV.dbname['lead_website'].update_many({'_id':ObjectId(str(valide_lead_website_data['_id']))},
{'$set':update_data})
return True, "Le devis a été crée avec la référence "+str(local_create_quotation_ref_interne)
return True, "Le devis a été crée avec la référence "+str(local_create_quotation_ref_interne), str(local_create_quotation_ref_interne)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de faire la relance du devis "
return False, "Impossible de faire la relance du devis ", False

View File

@ -3480,6 +3480,11 @@ def GetAttendeeDetail_perSession(diction):
my_retrun_dict['financeur_rattachement_id'] = financeur_rattachement_id
my_retrun_dict['financeur_rattachement_nom'] = financeur_rattachement_nom
if ("facture_client_rattachement_id" in local_Insc_retval.keys()):
my_retrun_dict['facture_client_rattachement_id'] = local_Insc_retval['facture_client_rattachement_id']
else:
my_retrun_dict['facture_client_rattachement_id'] = ""
v = local_Insc_retval['_id'].generation_time
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))