05/03/2024 - 14h30
parent
b97157962d
commit
4d2f74ece1
|
@ -1,10 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="sss">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="04/03/2024 - 22h15">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.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>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -74,13 +75,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00186" summary="03/01/2024 - 17h30">
|
|
||||||
<created>1704298822115</created>
|
|
||||||
<option name="number" value="00186" />
|
|
||||||
<option name="presentableId" value="LOCAL-00186" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1704298822115</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00187" summary="04/01/2024 - 22h30">
|
<task id="LOCAL-00187" summary="04/01/2024 - 22h30">
|
||||||
<created>1704403529234</created>
|
<created>1704403529234</created>
|
||||||
<option name="number" value="00187" />
|
<option name="number" value="00187" />
|
||||||
|
@ -417,7 +411,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1709567569247</updated>
|
<updated>1709567569247</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="235" />
|
<task id="LOCAL-00235" summary="04/03/2024 - 22h15">
|
||||||
|
<created>1709587020472</created>
|
||||||
|
<option name="number" value="00235" />
|
||||||
|
<option name="presentableId" value="LOCAL-00235" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1709587020474</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="236" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -432,7 +433,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="03/02/2024 - 21h" />
|
|
||||||
<MESSAGE value="04/02/2024 - 21h" />
|
<MESSAGE value="04/02/2024 - 21h" />
|
||||||
<MESSAGE value="04/02/2024 - 23h" />
|
<MESSAGE value="04/02/2024 - 23h" />
|
||||||
<MESSAGE value="05/02/2024 -23h" />
|
<MESSAGE value="05/02/2024 -23h" />
|
||||||
|
@ -457,6 +457,7 @@
|
||||||
<MESSAGE value="01/03/2024 - 23h30" />
|
<MESSAGE value="01/03/2024 - 23h30" />
|
||||||
<MESSAGE value="02/03/2024 - 23h20" />
|
<MESSAGE value="02/03/2024 - 23h20" />
|
||||||
<MESSAGE value="sss" />
|
<MESSAGE value="sss" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="sss" />
|
<MESSAGE value="04/03/2024 - 22h15" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="04/03/2024 - 22h15" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2146
Log/log_file.log
2146
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -72,7 +72,7 @@ def Add_CRM_Opportunite(diction):
|
||||||
Verification des input acceptés
|
Verification des input acceptés
|
||||||
"""
|
"""
|
||||||
field_list = ['token', 'partner_client_id', 'contact_civilite', 'contact_nom', 'contact_email', 'contact_telephone',
|
field_list = ['token', 'partner_client_id', 'contact_civilite', 'contact_nom', 'contact_email', 'contact_telephone',
|
||||||
'titre', 'description', 'revenu_cible', 'probabilite_gain', 'statut', 'priorite', 'commentaire',
|
'titre', 'description', 'revenu_cible', 'probabilite_gain', 'statut_id', 'priorite', 'commentaire',
|
||||||
'vendeur_id', 'date_fermeture']
|
'vendeur_id', 'date_fermeture']
|
||||||
|
|
||||||
incom_keys = diction.keys()
|
incom_keys = diction.keys()
|
||||||
|
@ -198,7 +198,7 @@ def Update_CRM_Opportunite(diction):
|
||||||
Verification des input acceptés
|
Verification des input acceptés
|
||||||
"""
|
"""
|
||||||
field_list = ['token', 'partner_client_id', 'contact_civilite', 'contact_nom', 'contact_email', 'contact_telephone',
|
field_list = ['token', 'partner_client_id', 'contact_civilite', 'contact_nom', 'contact_email', 'contact_telephone',
|
||||||
'titre', 'description', 'revenu_cible', 'probabilite_gain', 'statut', 'priorite', 'commentaire',
|
'titre', 'description', 'revenu_cible', 'probabilite_gain', 'statut_id', 'priorite', 'commentaire',
|
||||||
'vendeur_id', 'date_fermeture', 'opport_id']
|
'vendeur_id', 'date_fermeture', 'opport_id']
|
||||||
|
|
||||||
incom_keys = diction.keys()
|
incom_keys = diction.keys()
|
||||||
|
@ -390,6 +390,20 @@ def Get_List_CRM_Opportunite_with_filter(diction):
|
||||||
user['id'] = str(val_tmp)
|
user['id'] = str(val_tmp)
|
||||||
val_tmp = val_tmp + 1
|
val_tmp = val_tmp + 1
|
||||||
|
|
||||||
|
""" Recuperer les données du statut """
|
||||||
|
statut = ""
|
||||||
|
if ('statut_id' in New_retVal.keys()):
|
||||||
|
statut_data = MYSY_GV.dbname['base_partner_opportunite_step'].find_one(
|
||||||
|
{'partner_owner_recid': my_partner['recid'],
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'_id': ObjectId(str(New_retVal['statut_id']))})
|
||||||
|
|
||||||
|
if (statut_data and 'code' in statut_data.keys()):
|
||||||
|
statut = statut_data['code']
|
||||||
|
|
||||||
|
user['statut'] = statut
|
||||||
|
|
||||||
client_nom = ""
|
client_nom = ""
|
||||||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||||
|
@ -444,8 +458,6 @@ def Get_List_CRM_Opportunite_with_filter(diction):
|
||||||
if ("probabilite_gain" not in New_retVal.keys()):
|
if ("probabilite_gain" not in New_retVal.keys()):
|
||||||
user['probabilite_gain'] = ""
|
user['probabilite_gain'] = ""
|
||||||
|
|
||||||
if ("statut" not in New_retVal.keys()):
|
|
||||||
user['statut'] = ""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -519,6 +531,20 @@ def Get_List_CRM_Opportunite_no_filter(diction):
|
||||||
val_tmp = val_tmp + 1
|
val_tmp = val_tmp + 1
|
||||||
|
|
||||||
|
|
||||||
|
""" Recuperer les données du statut """
|
||||||
|
statut = ""
|
||||||
|
if( 'statut_id' in New_retVal.keys() ):
|
||||||
|
statut_data = MYSY_GV.dbname['base_partner_opportunite_step'].find_one({'partner_owner_recid':my_partner['recid'],
|
||||||
|
'valide':'1',
|
||||||
|
'locked':'0',
|
||||||
|
'_id':ObjectId(str(New_retVal['statut_id']))})
|
||||||
|
|
||||||
|
if( statut_data and 'code' in statut_data.keys()):
|
||||||
|
statut = statut_data['code']
|
||||||
|
|
||||||
|
user['statut'] = statut
|
||||||
|
|
||||||
|
|
||||||
client_nom = ""
|
client_nom = ""
|
||||||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||||
|
@ -572,8 +598,7 @@ def Get_List_CRM_Opportunite_no_filter(diction):
|
||||||
if ("probabilite_gain" not in New_retVal.keys()):
|
if ("probabilite_gain" not in New_retVal.keys()):
|
||||||
user['probabilite_gain'] = ""
|
user['probabilite_gain'] = ""
|
||||||
|
|
||||||
if ("statut" not in New_retVal.keys()):
|
|
||||||
user['statut'] = ""
|
|
||||||
|
|
||||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||||
|
|
||||||
|
@ -640,6 +665,21 @@ def Get_Given_CRM_Opportunite(diction):
|
||||||
user['id'] = str(val_tmp)
|
user['id'] = str(val_tmp)
|
||||||
val_tmp = val_tmp + 1
|
val_tmp = val_tmp + 1
|
||||||
|
|
||||||
|
""" Recuperer les données du statut """
|
||||||
|
statut = ""
|
||||||
|
if ('statut_id' in New_retVal.keys()):
|
||||||
|
statut_data = MYSY_GV.dbname['base_partner_opportunite_step'].find_one(
|
||||||
|
{'partner_owner_recid': my_partner['recid'],
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0',
|
||||||
|
'_id': ObjectId(str(New_retVal['statut_id']))})
|
||||||
|
|
||||||
|
if (statut_data and 'code' in statut_data.keys()):
|
||||||
|
statut = statut_data['code']
|
||||||
|
|
||||||
|
user['statut'] = statut
|
||||||
|
|
||||||
|
|
||||||
client_nom = ""
|
client_nom = ""
|
||||||
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
if ("partner_client_id" in New_retVal.keys() and New_retVal['partner_client_id']):
|
||||||
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
partner_client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||||
|
@ -693,8 +733,6 @@ def Get_Given_CRM_Opportunite(diction):
|
||||||
if ("probabilite_gain" not in New_retVal.keys()):
|
if ("probabilite_gain" not in New_retVal.keys()):
|
||||||
user['probabilite_gain'] = ""
|
user['probabilite_gain'] = ""
|
||||||
|
|
||||||
if ("statut" not in New_retVal.keys()):
|
|
||||||
user['statut'] = ""
|
|
||||||
|
|
||||||
|
|
||||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||||
|
@ -920,3 +958,171 @@ def Get_CRM_List_Opportunite_Etape(diction):
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, " Impossible de recuperer les étapes des opportunité "
|
return False, " Impossible de recuperer les étapes des opportunité "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Supprimer une étape d'opportunité.
|
||||||
|
/!\ Ceci n'est possible que si aucune opportunité n'a cette étape
|
||||||
|
"""
|
||||||
|
def Delete_CRM_List_Opportunite_Etape(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', '_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', '_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 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
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verifier que cette étape n'est utilisé par aucune opportunité
|
||||||
|
"""
|
||||||
|
is_etape_used = MYSY_GV.dbname['crm_opportunite'].count_documents({"partner_owner_recid":str(my_partner['recid']),
|
||||||
|
'valide':'1',
|
||||||
|
'statut_id':diction['_id']})
|
||||||
|
if( is_etape_used > 0 ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Cette étape est actuellement utilisée par "+str(is_etape_used)+" opportunités")
|
||||||
|
return False, " Cette étape est actuellement utilisée par "+str(is_etape_used)+" opportunités "
|
||||||
|
|
||||||
|
|
||||||
|
# Supression à faire
|
||||||
|
MYSY_GV.dbname['base_partner_opportunite_step'].delete_one(
|
||||||
|
{"partner_owner_recid": str(my_partner['recid']),
|
||||||
|
|
||||||
|
'_id': ObjectId(str(diction['_id']))})
|
||||||
|
|
||||||
|
|
||||||
|
return True, " L'étape a été correctement supprimée"
|
||||||
|
|
||||||
|
|
||||||
|
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 recuperer les étapes des opportunité "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Mettre à jour une étape d'opportunité
|
||||||
|
"""
|
||||||
|
|
||||||
|
def Update_CRM_List_Opportunite_Etape(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', '_id', 'code', 'description', 'rang']
|
||||||
|
|
||||||
|
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', '_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 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
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verifier que cette étape existe
|
||||||
|
"""
|
||||||
|
is_etape_used = MYSY_GV.dbname['base_partner_opportunite_step'].count_documents({"partner_owner_recid":str(my_partner['recid']),
|
||||||
|
'valide':'1',
|
||||||
|
'_id':ObjectId(str(diction['_id']))})
|
||||||
|
if( is_etape_used < 0 ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " L'identifiant de l'étape est invalide ")
|
||||||
|
return False, " L'identifiant de l'étape est invalide "
|
||||||
|
|
||||||
|
|
||||||
|
new_data = {}
|
||||||
|
local_id = diction['_id']
|
||||||
|
|
||||||
|
new_data = diction
|
||||||
|
del diction['_id']
|
||||||
|
del diction['token']
|
||||||
|
|
||||||
|
data_cle = {'_id': ObjectId(str(local_id)), 'valide': '1', 'locked': '0',
|
||||||
|
'partner_owner_recid': str(my_partner['recid']), }
|
||||||
|
|
||||||
|
inserted_id = ""
|
||||||
|
result = MYSY_GV.dbname['base_partner_opportunite_step'].find_one_and_update(
|
||||||
|
data_cle,
|
||||||
|
{"$set": new_data},
|
||||||
|
upsert=False,
|
||||||
|
return_document=ReturnDocument.AFTER
|
||||||
|
)
|
||||||
|
if (result is None or "_id" not in result.keys()):
|
||||||
|
mycommon.myprint(
|
||||||
|
" Impossible de mettre à jour l'étape (2) ")
|
||||||
|
return False, " Impossible de mettre à jour l'étape (2) "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return True, " L'étape a été correctement mise à jour"
|
||||||
|
|
||||||
|
|
||||||
|
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 mettre à jour l'étape "
|
||||||
|
|
||||||
|
|
29
main.py
29
main.py
|
@ -7600,6 +7600,35 @@ def Get_CRM_List_Opportunite_Etape():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API de suppression d'un étape d'opportunité
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Delete_CRM_List_Opportunite_Etape/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Delete_CRM_List_Opportunite_Etape():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Delete_CRM_List_Opportunite_Etape payload = ",payload)
|
||||||
|
print(request.files)
|
||||||
|
status, retval = crm_opportunite.Delete_CRM_List_Opportunite_Etape(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API de mise à jour d'un étape d'opportunité
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Update_CRM_List_Opportunite_Etape/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Update_CRM_List_Opportunite_Etape():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Update_CRM_List_Opportunite_Etape payload = ",payload)
|
||||||
|
print(request.files)
|
||||||
|
status, retval = crm_opportunite.Update_CRM_List_Opportunite_Etape(payload)
|
||||||
|
return jsonify(status=status, message=retval)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
API de creation d'une opportinité
|
API de creation d'une opportinité
|
||||||
|
|
Loading…
Reference in New Issue