09/11/2023 - 23h
parent
7d50901dd0
commit
ba57249927
|
@ -4,7 +4,8 @@
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/11/2023 - 23h">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="08/11/2023 - 23h">
|
||||||
<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$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.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-00091" summary="30/08/23 - 17h">
|
|
||||||
<created>1693408957444</created>
|
|
||||||
<option name="number" value="00091" />
|
|
||||||
<option name="presentableId" value="LOCAL-00091" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1693408957445</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00092" summary="30/08/23 - 22h">
|
<task id="LOCAL-00092" summary="30/08/23 - 22h">
|
||||||
<created>1693425919707</created>
|
<created>1693425919707</created>
|
||||||
<option name="number" value="00092" />
|
<option name="number" value="00092" />
|
||||||
|
@ -417,7 +411,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1699480833290</updated>
|
<updated>1699480833290</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="140" />
|
<task id="LOCAL-00140" summary="08/11/2023 - 23h">
|
||||||
|
<created>1699540554776</created>
|
||||||
|
<option name="number" value="00140" />
|
||||||
|
<option name="presentableId" value="LOCAL-00140" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699540554777</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="141" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
|
1006
Log/log_file.log
1006
Log/log_file.log
File diff suppressed because it is too large
Load Diff
17
main.py
17
main.py
|
@ -4802,6 +4802,23 @@ def Convert_Quotation_to_Order():
|
||||||
return jsonify(status=status, message=message, retval=retval)
|
return jsonify(status=status, message=message, retval=retval)
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API pour mettre la commande 'pret pour facturation'
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
Conversion d'un devis en commande
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Order_Ready_To_Invoice/', methods=['GET','POST'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Order_Ready_To_Invoice():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Order_Ready_To_Invoice payload = ", str(payload))
|
||||||
|
status, message = partner_order.Order_Ready_To_Invoice(payload)
|
||||||
|
return jsonify(status=status, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
API de recuperation de tous les champs personnalisables dans un document
|
API de recuperation de tous les champs personnalisables dans un document
|
||||||
|
|
140
partner_order.py
140
partner_order.py
|
@ -2299,7 +2299,7 @@ def Confirm_Partner_Order_Header_And_Lines(diction):
|
||||||
if( str(my_order_data_previous_information['order_header_status']) != "0" and str(my_order_data_previous_information['order_header_status']) != "1"):
|
if( str(my_order_data_previous_information['order_header_status']) != "0" and str(my_order_data_previous_information['order_header_status']) != "1"):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
str(inspect.stack()[0][3]) + " - Le document doit être au statut 'en cours' ou 'brouillon' pour avant d'être confirmé ")
|
str(inspect.stack()[0][3]) + " - Le document doit être au statut 'en cours' ou 'brouillon' pour avant d'être confirmé ")
|
||||||
return False, " Le document doit être au statut 'en cours' ou 'brouillon' pour avant d'être confirmé ",
|
return False, " Le document doit être au statut 'en cours' ou 'brouillon' avant d'être confirmé ",
|
||||||
|
|
||||||
|
|
||||||
# Si la l'order est un devis, on verifie s'il n'a pas expiré
|
# Si la l'order est un devis, on verifie s'il n'a pas expiré
|
||||||
|
@ -2369,7 +2369,7 @@ def Confirm_Partner_Order_Header_And_Lines(diction):
|
||||||
|
|
||||||
local_retval, local_message = Compute_Order_Header(comput_diction)
|
local_retval, local_message = Compute_Order_Header(comput_diction)
|
||||||
if( local_retval is False) :
|
if( local_retval is False) :
|
||||||
mycommon.myprint(" WARNING : Apres la confirmation, La fonction compute pour l'ordre : "+str(comput_diction)+" n'a pas fonction, ")
|
mycommon.myprint(" WARNING : Apres la confirmation, La fonction compute pour l'ordre : "+str(comput_diction)+" n'a pas fonctionnée, ")
|
||||||
|
|
||||||
return True, " Le document a été correctement mise à jour"
|
return True, " Le document a été correctement mise à jour"
|
||||||
|
|
||||||
|
@ -4804,3 +4804,139 @@ def Convert_Quotation_to_Order(diction):
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
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))
|
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, "Impossible de convertir le devis en commande", False
|
return False, "Impossible de convertir le devis en commande", False
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction met une commande et lignes associées au statuts = '2', c'est a dire : pret à etre facturé
|
||||||
|
"""
|
||||||
|
def Order_Ready_To_Invoice(diction):
|
||||||
|
try:
|
||||||
|
diction = mycommon.strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', 'order_header_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', 'order_header_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
|
||||||
|
|
||||||
|
order_header_id = ""
|
||||||
|
if ("order_header_id" in diction.keys()):
|
||||||
|
if diction['order_header_id']:
|
||||||
|
order_header_id = diction['order_header_id']
|
||||||
|
|
||||||
|
|
||||||
|
my_order_data_count = MYSY_GV.dbname['partner_order_header'].count_documents(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1', 'locked': '0',
|
||||||
|
'_id': ObjectId(str(order_header_id))})
|
||||||
|
|
||||||
|
if (my_order_data_count != 1):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - L'identifiant de la commande est invalide ")
|
||||||
|
return False, " L'identifiant de la commande est invalide",
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Recuperation et stockage des données de l'entete avant mise à jour
|
||||||
|
"""
|
||||||
|
my_order_data_previous_information = MYSY_GV.dbname['partner_order_header'].find_one(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1', 'locked': '0',
|
||||||
|
'_id': ObjectId(str(order_header_id))})
|
||||||
|
|
||||||
|
if ( str(my_order_data_previous_information['order_header_status']) != "1" or str(my_order_data_previous_information['order_header_type']) != "commande"):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " - La commande doit être au statut 'en cours' avant d'être confirmé mise en facture ")
|
||||||
|
return False, " La commande doit être au statut 'en cours' avant d'être confirmé mise en facture"
|
||||||
|
|
||||||
|
### 1 - Mise à jour de l'entete
|
||||||
|
# Recuperation des champs
|
||||||
|
data = {}
|
||||||
|
data['date_update'] = str(datetime.now())
|
||||||
|
data['order_header_status'] = "2"
|
||||||
|
|
||||||
|
print(" ### Update_partner_order data = ", data)
|
||||||
|
|
||||||
|
inserted_data = MYSY_GV.dbname['partner_order_header'].find_one_and_update(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1', 'locked': '0',
|
||||||
|
'_id': ObjectId(str(order_header_id))},
|
||||||
|
{"$set": data},
|
||||||
|
return_document=ReturnDocument.AFTER,
|
||||||
|
upsert=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (inserted_data is None):
|
||||||
|
mycommon.myprint(
|
||||||
|
" Impossible de mettre à jour l'entete de commande ")
|
||||||
|
return False, "Impossible de mettre à jour l'entete de commande "
|
||||||
|
|
||||||
|
"""
|
||||||
|
Mise à jour des lignes (partner_order_line) dont les status sont à 0 (brouillon)
|
||||||
|
"""
|
||||||
|
local_qry = {'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1', 'locked': '0',
|
||||||
|
'order_header_id': str(order_header_id)
|
||||||
|
}
|
||||||
|
# print(" #### COMMANDE local_qry = ", local_qry)
|
||||||
|
|
||||||
|
inserted_data_line = MYSY_GV.dbname['partner_order_line'].update_many(
|
||||||
|
{'partner_owner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1', 'locked': '0',
|
||||||
|
'order_header_id': str(order_header_id),
|
||||||
|
'order_line_status': '1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$set": {"order_line_status": "2",
|
||||||
|
'date_update': str(data['date_update'])}
|
||||||
|
})
|
||||||
|
"""print("raw:", inserted_data_line.raw_result)
|
||||||
|
print("acknowledged:", inserted_data_line.acknowledged)
|
||||||
|
print("matched_count:", inserted_data_line.matched_count)"""
|
||||||
|
|
||||||
|
comput_diction = {}
|
||||||
|
comput_diction['token'] = diction['token']
|
||||||
|
comput_diction['_id'] = diction['order_header_id']
|
||||||
|
|
||||||
|
local_retval, local_message = Compute_Order_Header(comput_diction)
|
||||||
|
if (local_retval is False):
|
||||||
|
mycommon.myprint(" WARNING : Apres la confirmation, La fonction compute pour l'ordre : " + str(
|
||||||
|
comput_diction) + " n'a pas fonctionnée, ")
|
||||||
|
|
||||||
|
return True, " Le document 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 le document "
|
Loading…
Reference in New Issue