12/09/2024 - 13:00

master
cherif 2024-09-12 12:53:17 +02:00
parent 761a953476
commit c8d17afaac
6 changed files with 4119 additions and 16 deletions

View File

@ -1,10 +1,13 @@
<?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="08/09/2024 - 21h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/09/2024 - 21terth">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -74,13 +77,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00345" summary="wwssdss">
<created>1720531095887</created>
<option name="number" value="00345" />
<option name="presentableId" value="LOCAL-00345" />
<option name="project" value="LOCAL" />
<updated>1720531095888</updated>
</task>
<task id="LOCAL-00346" summary="wwssdssd">
<created>1720553186262</created>
<option name="number" value="00346" />
@ -417,7 +413,14 @@
<option name="project" value="LOCAL" />
<updated>1725823501100</updated>
</task>
<option name="localTasksCounter" value="394" />
<task id="LOCAL-00394" summary="08/09/2024 - 21terth">
<created>1725902258192</created>
<option name="number" value="00394" />
<option name="presentableId" value="LOCAL-00394" />
<option name="project" value="LOCAL" />
<updated>1725902258192</updated>
</task>
<option name="localTasksCounter" value="395" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -459,7 +462,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="11/08/2024 - 12h32s" />
<MESSAGE value="11/08/2024 - 18h32s" />
<MESSAGE value="dd" />
<MESSAGE value="dddss" />
@ -484,6 +486,7 @@
<MESSAGE value="qsh" />
<MESSAGE value="06/09/2024 - 22h" />
<MESSAGE value="08/09/2024 - 21h" />
<option name="LAST_COMMIT_MESSAGE" value="08/09/2024 - 21h" />
<MESSAGE value="08/09/2024 - 21terth" />
<option name="LAST_COMMIT_MESSAGE" value="08/09/2024 - 21terth" />
</component>
</project>

View File

@ -293,7 +293,7 @@ def Get_Humain_Ressource_With_Planning(diction):
"""
Gerer les eventuels cas d'erreur sur une date de fin event < debut event
"""
if (event_duration_second < 0):
if (event_duration_second.total_seconds() < 0):
event_duration_second = 0
event_duration_second = event_duration_second.total_seconds()

File diff suppressed because it is too large Load Diff

View File

@ -12983,6 +12983,7 @@ def Add_SessionFormation_From_Quotation_Line(diction):
new_data['civilite'] = "neutre"
new_data['quotation_id'] = str(quotation_line_data['order_header_id'])
new_data['status'] = "0"
new_data['type_apprenant'] = "1"
"""
/!\

View File

@ -260,7 +260,7 @@ def Get_Partner_Catalog_Pub_Config(diction):
RetObject.append(mycommon.JSONEncoder().encode(user))
print(" ### Get_Partner_Catalog_Pub_Config = RetObject = ", RetObject);
#print(" ### Get_Partner_Catalog_Pub_Config = RetObject = ", RetObject);
return True, RetObject

View File

@ -172,12 +172,143 @@ def Add_CRM_Opportunite(diction):
inserted_id = MYSY_GV.dbname['crm_opportunite'].insert_one(mydata).inserted_id
opp_inserted_id = MYSY_GV.dbname['crm_opportunite'].insert_one(mydata).inserted_id
if (not inserted_id):
if (not opp_inserted_id):
mycommon.myprint(" Impossible de créer l'opportunité (2) ")
return False, " Impossible de créer l'opportunité (2) "
#------------------
"""
Recuperer le modèle de document
"""
local_diction = {}
local_diction['ref_interne'] = "CRM_OPPORTUNITE_CHANGE_NOTIF"
local_diction['type_doc'] = "email"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
if (courrier_data_status is False):
return courrier_data_status, courrier_data_retval
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'CRM_OPPORTUNITE_CHANGE_NOTIF' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'CRM_OPPORTUNITE_CHANGE_NOTIF' n'est pas correctement configuré "
# Recuperation des donnes smtp
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
my_partner['recid'])
if (local_stpm_status is False):
return local_stpm_status, partner_own_smtp_value
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = str(token)
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = []
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
new_status_id_data = MYSY_GV.dbname['base_partner_opportunite_step'].find_one(
{'_id': ObjectId(str(diction['statut_id'])),
'valide': '1',
'locked': '0',
}, {'description': 1, 'gagne': 1})
print(" #### new_status_id_data = ", new_status_id_data)
new_status_label = ""
if (new_status_id_data and "description" in new_status_id_data.keys()):
new_status_label = new_status_id_data['description']
new_status_is_gagne = "0"
if (new_status_id_data and "gagne" in new_status_id_data.keys()):
new_status_is_gagne = new_status_id_data['gagne']
crm_opp_data = mydata
crm_opp_data['new_status_label'] = str(new_status_label)
crm_opp_data['new_status_is_gagne'] = str(new_status_is_gagne)
dictionnary_data = local_retval
dictionnary_data['mysyurl'] = MYSY_GV.CLIENT_URL_BASE + "Partner/mes_opportunites"
dictionnary_data['crm_opp_data'] = crm_opp_data
body = {
"params": dictionnary_data,
}
"""
Recuperer les donnés du vendeur associé à l'opportunité
"""
email_to = []
if ("vendeur_id" in mydata.keys() and mydata['vendeur_id']):
vendeur_id_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id': ObjectId(str(mydata['vendeur_id'])),
'valide': '1',
'partner_recid': str(my_partner['recid'])})
if (vendeur_id_data and "email" in vendeur_id_data.keys() and vendeur_id_data[
'email']):
email_to.append(str(vendeur_id_data['email']))
if (vendeur_id_data and "diffusion_mail" in vendeur_id_data.keys() and vendeur_id_data['diffusion_mail']):
email_to.append(str(vendeur_id_data['diffusion_mail']))
if (str(partner_own_smtp_value) == "1"):
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
else:
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
# Traitement du sujet du mail
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Traitement du corps du mail
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
sourceHtml = contenu_doc_Template.render(params=body["params"])
html_mime = MIMEText(sourceHtml, 'html')
# Creation de l'email à enoyer
msg = MIMEMultipart("alternative")
if (str(partner_own_smtp_value) == "1"):
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = sujetHtml
toaddrs = ", ".join(email_to)
msg['to'] = str(toaddrs)
val = smtpserver.send_message(msg)
print(" Email de notification envoyé " + str(val))
else:
msg.attach(html_mime)
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = sujetHtml
toaddrs = ", ".join(email_to)
msg['to'] = str(toaddrs)
val = smtpserver.send_message(msg)
print(" Email de notification envoyé " + str(val))
smtpserver.close()
#------------------
return True, " L'opportunité a été correctement ajoutée "
@ -914,6 +1045,7 @@ def Get_Given_CRM_Opportunite(diction):
""" Recuperer les données du statut """
statut = ""
is_gagne = ""
if ('statut_id' in New_retVal.keys()):
statut_data = MYSY_GV.dbname['base_partner_opportunite_step'].find_one(
{'partner_owner_recid': my_partner['recid'],
@ -924,7 +1056,11 @@ def Get_Given_CRM_Opportunite(diction):
if (statut_data and 'code' in statut_data.keys()):
statut = statut_data['code']
if (statut_data and 'gagne' in statut_data.keys()):
is_gagne = statut_data['gagne']
user['statut'] = statut
user['is_gagne'] = is_gagne
client_nom = ""