02/03/2024 - 23h20

master
cherif 2024-03-02 23:21:00 +01:00
parent c27460b015
commit 3b4852fb90
5 changed files with 3922 additions and 22 deletions

View File

@ -1,10 +1,12 @@
<?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="29/02/2024 - 21h30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="01/03/2024 - 23h30">
<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$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -74,13 +76,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00183" summary="29/12/2023- 12h">
<created>1703848960675</created>
<option name="number" value="00183" />
<option name="presentableId" value="LOCAL-00183" />
<option name="project" value="LOCAL" />
<updated>1703848960676</updated>
</task>
<task id="LOCAL-00184" summary="31/12/2023- 18h">
<created>1704042376850</created>
<option name="number" value="00184" />
@ -417,7 +412,14 @@
<option name="project" value="LOCAL" />
<updated>1709239297474</updated>
</task>
<option name="localTasksCounter" value="232" />
<task id="LOCAL-00232" summary="01/03/2024 - 23h30">
<created>1709333684065</created>
<option name="number" value="00232" />
<option name="presentableId" value="LOCAL-00232" />
<option name="project" value="LOCAL" />
<updated>1709333684075</updated>
</task>
<option name="localTasksCounter" value="233" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -432,7 +434,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="31/01/2024 - 20h" />
<MESSAGE value="02/02/2024 - 17h" />
<MESSAGE value="02/02/2024 - 23h" />
<MESSAGE value="03/02/2024 - 21h" />
@ -457,6 +458,7 @@
<MESSAGE value="26/02/2024 - 16h30" />
<MESSAGE value="28/02/2024 - 21h30" />
<MESSAGE value="29/02/2024 - 21h30" />
<option name="LAST_COMMIT_MESSAGE" value="29/02/2024 - 21h30" />
<MESSAGE value="01/03/2024 - 23h30" />
<option name="LAST_COMMIT_MESSAGE" value="01/03/2024 - 23h30" />
</component>
</project>

View File

@ -643,4 +643,12 @@ les valeurs autorisées sont :
- facture = date facture
- mois = fin du mois
"""
PAIEMENT_CONDITION_DEPART = ['facture', 'mois']
PAIEMENT_CONDITION_DEPART = ['facture', 'mois']
"""
CRM :
Proabilité de gain valeur
"""
CRM_GAIN_PROBABILITE = ['faible', 'moyen', 'fort', 'inconnu', '']

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,17 @@ def Add_CRM_Opportunite(diction):
if val not in diction.keys():
mydata[str(val)] = ""
# Verifier les valeurs de la probabilité de gain
if( "probabilite_gain" in diction.keys() ):
if( str(diction['probabilite_gain']).lower().strip() not in MYSY_GV.CRM_GAIN_PROBABILITE):
mycommon.myprint(str(inspect.stack()[0][3]) + " La probabilité de gain " + str(
diction['probabilite_gain']) + " n'est pas valide. Les valeurs autorisées "+str(MYSY_GV.CRM_GAIN_PROBABILITE))
return False, " La probabilité de gain " + str(
diction['probabilite_gain']) + " n'est pas valide. Les valeurs autorisées "+str(MYSY_GV.CRM_GAIN_PROBABILITE)
mydata['probabilite_gain'] = str(diction['probabilite_gain']).lower().strip()
partner_client_id = ""
if( "partner_client_id" in diction['partner_client_id'] and diction['partner_client_id']):
partner_client_id = diction['partner_client_id']
@ -157,7 +168,7 @@ def Add_CRM_Opportunite(diction):
mydata['valide'] = "1"
mydata['locked'] = "0"
print(" #### mydata , ", mydata)
inserted_id = MYSY_GV.dbname['crm_opportunite'].insert_one(mydata).inserted_id
@ -199,8 +210,7 @@ def Update_CRM_Opportunite(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'contact_civilite', 'contact_nom', 'contact_email', 'contact_telephone',
'titre', 'opport_id']
field_list_obligatoire = ['token', 'opport_id']
for val in field_list_obligatoire:
if val not in diction:
@ -245,8 +255,21 @@ def Update_CRM_Opportunite(diction):
del mydata['token']
del mydata['opport_id']
# Verifier les valeurs de la probabilité de gain
if ("probabilite_gain" in diction.keys()):
if (str(diction['probabilite_gain']).lower().strip() not in MYSY_GV.CRM_GAIN_PROBABILITE):
mycommon.myprint(str(inspect.stack()[0][3]) + " La probabilité de gain " + str(
diction['probabilite_gain']) + " n'est pas valide. Les valeurs autorisées " + str(
MYSY_GV.CRM_GAIN_PROBABILITE))
return False, " La probabilité de gain " + str(
diction['probabilite_gain']) + " n'est pas valide. Les valeurs autorisées " + str(
MYSY_GV.CRM_GAIN_PROBABILITE)
mydata['probabilite_gain'] = str(diction['probabilite_gain']).lower().strip()
partner_client_id = ""
if( "partner_client_id" in diction['partner_client_id'] and diction['partner_client_id']):
if( "partner_client_id" in diction.keys() and diction['partner_client_id']):
partner_client_id = diction['partner_client_id']
# Verifier la valididé du client id
@ -262,9 +285,10 @@ def Update_CRM_Opportunite(diction):
# Verifier la validié de l'adress contact_email
if (mycommon.isEmailValide(str(diction['contact_email'])) is False ):
mycommon.myprint(str(inspect.stack()[0][3]) + " L'adresse email " + str(diction['contact_email']) + " n'est pas valide")
return False, " L'adresse email " + str(diction['contact_email']) + " n'est pas valide "
if( "contact_email" in diction.keys() ):
if (mycommon.isEmailValide(str(diction['contact_email'])) is False ):
mycommon.myprint(str(inspect.stack()[0][3]) + " L'adresse email " + str(diction['contact_email']) + " n'est pas valide")
return False, " L'adresse email " + str(diction['contact_email']) + " n'est pas valide "
# Verifier la valide du vendeur_id
@ -306,7 +330,7 @@ def Update_CRM_Opportunite(diction):
"""
Recuperer la liste des opportunités d'un partenaire
Recuperer la liste des opportunités d'un partenaire, avec des filtres
"""
def Get_List_CRM_Opportunite_with_filter(diction):
try:
@ -379,6 +403,153 @@ def Get_List_CRM_Opportunite_with_filter(diction):
user['vendeur_nom_prenom'] = vendeur_nom+" "+vendeur_prenom
if( "partner_client_id" not in New_retVal.keys() ):
user['partner_client_id'] = ""
if ("contact_civilite" not in New_retVal.keys()):
user['contact_civilite'] = ""
if ("contact_nom" not in New_retVal.keys()):
user['contact_nom'] = ""
if ("contact_email" not in New_retVal.keys()):
user['contact_email'] = ""
if ("contact_telephone" not in New_retVal.keys()):
user['contact_telephone'] = ""
if ("titre" not in New_retVal.keys()):
user['titre'] = ""
if ("description" not in New_retVal.keys()):
user['description'] = ""
if ("revenu_cible" not in New_retVal.keys()):
user['revenu_cible'] = ""
if ("probabilite_gain" not in New_retVal.keys()):
user['probabilite_gain'] = ""
if ("statut" not in New_retVal.keys()):
user['statut'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
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 la liste des opportunités "
"""
Recuperer la liste des opportunités d'un partenaire, sans filtres
"""
def Get_List_CRM_Opportunite_no_filter(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token' ]
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',]
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 liste ")
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
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
print(" ### qry 11 = ", qry)
for New_retVal in MYSY_GV.dbname['crm_opportunite'].find(qry):
user = New_retVal
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
vendeur_nom = ""
vendeur_prenom = ""
if( "vendeur_id" in New_retVal.keys() and New_retVal['vendeur_id']):
Employee_data = MYSY_GV.dbname['ressource_humaine'].find_one(
{'_id': ObjectId(str(New_retVal['vendeur_id'])), 'valide': '1', 'locked': '0',
'partner_recid': str(my_partner['recid'])})
if( "nom" in Employee_data.keys()):
vendeur_nom = Employee_data['nom']
if ("prenom" in Employee_data.keys()):
vendeur_prenom = Employee_data['prenom']
user['vendeur_nom_prenom'] = vendeur_nom+" "+vendeur_prenom
if ("partner_client_id" not in New_retVal.keys()):
user['partner_client_id'] = ""
if ("contact_civilite" not in New_retVal.keys()):
user['contact_civilite'] = ""
if ("contact_nom" not in New_retVal.keys()):
user['contact_nom'] = ""
if ("contact_email" not in New_retVal.keys()):
user['contact_email'] = ""
if ("contact_telephone" not in New_retVal.keys()):
user['contact_telephone'] = ""
if ("titre" not in New_retVal.keys()):
user['titre'] = ""
if ("description" not in New_retVal.keys()):
user['description'] = ""
if ("revenu_cible" not in New_retVal.keys()):
user['revenu_cible'] = ""
if ("probabilite_gain" not in New_retVal.keys()):
user['probabilite_gain'] = ""
if ("statut" not in New_retVal.keys()):
user['statut'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -437,7 +608,7 @@ def Get_Given_CRM_Opportunite(diction):
RetObject = []
val_tmp = 0
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', 'vendeur_id':str(diction['opport_id'])}
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', '_id':ObjectId(str(diction['opport_id']))}
for New_retVal in MYSY_GV.dbname['crm_opportunite'].find(qry):
user = New_retVal
@ -459,6 +630,37 @@ def Get_Given_CRM_Opportunite(diction):
user['vendeur_nom_prenom'] = vendeur_nom+" "+vendeur_prenom
if ("partner_client_id" not in New_retVal.keys()):
user['partner_client_id'] = ""
if ("contact_civilite" not in New_retVal.keys()):
user['contact_civilite'] = ""
if ("contact_nom" not in New_retVal.keys()):
user['contact_nom'] = ""
if ("contact_email" not in New_retVal.keys()):
user['contact_email'] = ""
if ("contact_telephone" not in New_retVal.keys()):
user['contact_telephone'] = ""
if ("titre" not in New_retVal.keys()):
user['titre'] = ""
if ("description" not in New_retVal.keys()):
user['description'] = ""
if ("revenu_cible" not in New_retVal.keys()):
user['revenu_cible'] = ""
if ("probabilite_gain" not in New_retVal.keys()):
user['probabilite_gain'] = ""
if ("statut" not in New_retVal.keys()):
user['statut'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))

16
main.py
View File

@ -7644,6 +7644,22 @@ def Get_List_CRM_Opportunite_with_filter():
"""
API de recuperation de la liste des opportunité sans filtre
"""
@app.route('/myclass/api/Get_List_CRM_Opportunite_no_filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_CRM_Opportunite_no_filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_CRM_Opportunite_no_filter payload = ",payload)
print(request.files)
status, retval = crm_opportunite.Get_List_CRM_Opportunite_no_filter(payload)
return jsonify(status=status, message=retval)
"""
API de recuperation des data d'une opportunité données
"""