24/02/2024 - 22h30
parent
30fe9071b3
commit
5880c38a3d
|
@ -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="ddr">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="23/02/2024 - 22h30">
|
||||
<change afterPath="$PROJECT_DIR$/paiement_condition.py" afterDir="false" />
|
||||
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.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-00176" summary="18/12/2023 - 18:00">
|
||||
<created>1702919463867</created>
|
||||
<option name="number" value="00176" />
|
||||
<option name="presentableId" value="LOCAL-00176" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1702919463869</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00177" summary="18/12/2023 - 22:00">
|
||||
<created>1702933100879</created>
|
||||
<option name="number" value="00177" />
|
||||
|
@ -419,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1708698485604</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="225" />
|
||||
<task id="LOCAL-00225" summary="23/02/2024 - 22h30">
|
||||
<created>1708724600232</created>
|
||||
<option name="number" value="00225" />
|
||||
<option name="presentableId" value="LOCAL-00225" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1708724600233</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="226" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -434,7 +437,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="22/01/2024 -22h00" />
|
||||
<MESSAGE value="24/01/2024 -12h00" />
|
||||
<MESSAGE value="rrr" />
|
||||
<MESSAGE value="rrrf" />
|
||||
|
@ -459,6 +461,7 @@
|
|||
<MESSAGE value="18/02/2024 - 14h" />
|
||||
<MESSAGE value="dd" />
|
||||
<MESSAGE value="ddr" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ddr" />
|
||||
<MESSAGE value="23/02/2024 - 22h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="23/02/2024 - 22h30" />
|
||||
</component>
|
||||
</project>
|
|
@ -633,4 +633,14 @@ CIVILITE = ['m', 'mme', 'neutre', ]
|
|||
"""
|
||||
Les prix de vente des formations
|
||||
"""
|
||||
TRAINING_PRICE = ['persession', 'perstagiaire', '']
|
||||
TRAINING_PRICE = ['persession', 'perstagiaire', '']
|
||||
|
||||
|
||||
"""
|
||||
Les conditions de paiement : Date depart
|
||||
xxx jrs fin du mois, ou y jours date facture.
|
||||
les valeurs autorisées sont :
|
||||
- facture = date facture
|
||||
- mois = fin du mois
|
||||
"""
|
||||
PAIEMENT_CONDITION_DEPART = ['facture', 'mois']
|
1442
Log/log_file.log
1442
Log/log_file.log
File diff suppressed because it is too large
Load Diff
71
main.py
71
main.py
|
@ -76,6 +76,7 @@ import module_editique as module_editique
|
|||
import attestation_formation as attestation_formation
|
||||
import crm_opportunite as crm_opportunite
|
||||
import site_formation as site_formation
|
||||
import paiement_condition as paiement_condition
|
||||
|
||||
|
||||
|
||||
|
@ -7784,6 +7785,76 @@ def Prepare_and_Send_Facture_From_Session_By_Email():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API: Ajout d'une condition de paiement
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Paiement_Condition/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Paiement_Condition():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Add_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API: Mise à jour d'une condition de paiement
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Paiement_Condition/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Paiement_Condition():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Update_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API: Suppression d'une condition de paiement
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Paiement_Condition/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Paiement_Condition():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Delete_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API: Recuperer la liste des conditions de paiement d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Paiement_Condition/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Paiement_Condition():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Get_List_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API: Recuperer les données d'un conditions de paiement d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Paiement_Condition/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Paiement_Condition():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Paiement_Condition payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = paiement_condition.Get_Given_Paiement_Condition(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
|
@ -0,0 +1,498 @@
|
|||
"""
|
||||
Ce fichier permet de gerer les coditions de paiement d'un partenaire vers ses clients
|
||||
ex : X jours Date de facture
|
||||
|
||||
champs :
|
||||
code
|
||||
description
|
||||
nb_jour
|
||||
depart (fature / mois)
|
||||
|
||||
"""
|
||||
import bson
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
|
||||
"""
|
||||
Ajout d'une condition de paiement
|
||||
"""
|
||||
|
||||
def Add_Paiement_Condition(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'description', 'nb_jour', 'depart']
|
||||
|
||||
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', 'code', 'description', 'nb_jour', 'depart']
|
||||
|
||||
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
|
||||
|
||||
|
||||
# Verifier que ce code n'existe pas déjà
|
||||
is_existe_cdtion_paiement = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_existe_cdtion_paiement > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Une condition de paiement avec le code '" + str(diction['code']) + "' existe déjà ")
|
||||
return False, " Une condition de paiement avec le code '" + str(diction['code']) + "' existe déjà "
|
||||
|
||||
|
||||
nb_jour = diction['nb_jour']
|
||||
nb_jour_status, nb_jour_retval = mycommon.IsInt(nb_jour)
|
||||
if( nb_jour_status is False ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le nombre de jours '" + str(diction['nb_jour']) + "' n'est pas un entier ")
|
||||
return False, " Le nombre de jours '" + str(diction['nb_jour']) + "' n'est pas un entier "
|
||||
|
||||
depart = str(diction['depart']).strip().lower()
|
||||
if( depart not in MYSY_GV.PAIEMENT_CONDITION_DEPART):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le depart '" + str(diction['depart']) + "' n'est pas autorisé. Les valeurs acceptées sont : "+str(MYSY_GV.PAIEMENT_CONDITION_DEPART))
|
||||
return False, " Le depart '" + str(diction['depart']) + "' n'est pas autorisé. Les valeurs acceptées sont : "+str(MYSY_GV.PAIEMENT_CONDITION_DEPART)
|
||||
|
||||
|
||||
new_data = diction
|
||||
del diction['token']
|
||||
|
||||
new_data['depart'] = depart
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['locked'] = "0"
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
new_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
inserted_id = MYSY_GV.dbname['base_partner_paiement_condition'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le condition de paiement (2) ")
|
||||
return False, " Impossible de créer la condition de paiement (2) "
|
||||
|
||||
|
||||
return True, " La condition de paiement a été correctement ajouté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 d'ajouter la condition de paiement "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Mise à jour d'une condition de paiement
|
||||
"""
|
||||
|
||||
def Update_Paiement_Condition(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'code', 'description', 'nb_jour', 'depart', '_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
|
||||
|
||||
new_data = diction
|
||||
|
||||
# Verifier que la codition de paiement existe
|
||||
is_existe_cdtion_paiement = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_cdtion_paiement < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Une condition de paiement n'existe pas ")
|
||||
return False, " Une condition de paiement n'existe pas "
|
||||
|
||||
if( "nb_jour" in diction.keys() ):
|
||||
nb_jour = diction['nb_jour']
|
||||
nb_jour_status, nb_jour_retval = mycommon.IsInt(nb_jour)
|
||||
if (nb_jour_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le nombre de jours '" + str(
|
||||
diction['nb_jour']) + "' n'est pas un entier ")
|
||||
return False, " Le nombre de jours '" + str(diction['nb_jour']) + "' n'est pas un entier "
|
||||
|
||||
if( "depart" in diction.keys() ):
|
||||
depart = str(diction['depart']).strip().lower()
|
||||
if (depart not in MYSY_GV.PAIEMENT_CONDITION_DEPART):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le depart '" + str(
|
||||
diction['depart']) + "' n'est pas autorisé. Les valeurs acceptées sont : " + str(
|
||||
MYSY_GV.PAIEMENT_CONDITION_DEPART))
|
||||
return False, " Le depart '" + str(
|
||||
diction['depart']) + "' n'est pas autorisé. Les valeurs acceptées sont : " + str(
|
||||
MYSY_GV.PAIEMENT_CONDITION_DEPART)
|
||||
|
||||
new_data['depart'] = depart
|
||||
|
||||
local_id = str(diction['_id'])
|
||||
|
||||
del diction['token']
|
||||
del diction['_id']
|
||||
|
||||
|
||||
new_data['date_update'] = str(datetime.now())
|
||||
new_data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['_id'] = ObjectId(local_id)
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
result = MYSY_GV.dbname['base_partner_paiement_condition'].find_one_and_update(
|
||||
data_cle,
|
||||
{"$set": new_data},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour le condition de paiement (2) ")
|
||||
return False, " Impossible de mettre à jour la condition de paiement (2) "
|
||||
|
||||
return True, " La condition de paiement 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 la condition de paiement "
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une condition de paiement
|
||||
regles :
|
||||
Si la condition (_id) n'est pas utiliser dans les collection
|
||||
- partner_invoice_header
|
||||
- partner_order_header
|
||||
"""
|
||||
|
||||
def Delete_Paiement_Condition(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
|
||||
|
||||
|
||||
# Verifier que la codition de paiement existe
|
||||
is_existe_cdtion_paiement = MYSY_GV.dbname['base_partner_paiement_condition'].count_documents(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_existe_cdtion_paiement < 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Une condition de paiement n'existe pas ")
|
||||
return False, " Une condition de paiement n'existe pas "
|
||||
|
||||
|
||||
"""
|
||||
Verifier que la condition n'est pas utilisée (collection : partner_order_header, partner_invoice_header
|
||||
"""
|
||||
is_condition_in_partner_order_header = MYSY_GV.dbname['partner_order_header'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'order_header_condition_paiement':str(diction['_id'])})
|
||||
|
||||
|
||||
if( is_condition_in_partner_order_header > 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Cette condition est utilisée dans "+str(is_condition_in_partner_order_header)+" commandes ")
|
||||
return False, " Cette condition est utilisée dans "+str(is_condition_in_partner_order_header)+" commandes "
|
||||
|
||||
is_condition_in_partner_invoice_header = MYSY_GV.dbname['partner_invoice_header'].count_documents(
|
||||
{'partner_owner_recid': my_partner['recid'],
|
||||
'valide': '1',
|
||||
'order_header_condition_paiement': str(diction['_id'])})
|
||||
|
||||
if (is_condition_in_partner_invoice_header > 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Cette condition est utilisée dans " + str(
|
||||
is_condition_in_partner_invoice_header) + " factures ")
|
||||
return False, " Cette condition est utilisée dans " + str(
|
||||
is_condition_in_partner_invoice_header) + " factures "
|
||||
|
||||
|
||||
delete = MYSY_GV.dbname['base_partner_paiement_condition'].delete_one({'_id': ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
|
||||
return True, " La condition de paiement 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 supprimer la condition de paiement "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des conditions de paiement d'un partenaire
|
||||
"""
|
||||
def Get_List_Paiement_Condition(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'existe pas")
|
||||
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
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['base_partner_paiement_condition'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
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 conditions de paiement "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'une conditions de paiement donnée
|
||||
"""
|
||||
def Get_Given_Paiement_Condition(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'existe pas")
|
||||
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
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['_id'] = ObjectId(str(diction['_id']))
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['base_partner_paiement_condition'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
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 les données de la condition de paiement "
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ def Add_Partner_Client(diction):
|
|||
"telephone", "website", "comment", "address", "invoice_address", "list_contact",
|
||||
'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_pays',
|
||||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_tva', 'invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', "client_type_id",
|
||||
'is_fournisseur', 'is_client', 'is_financeur']
|
||||
|
||||
|
@ -274,6 +274,12 @@ def Add_Partner_Client(diction):
|
|||
invoice_tva = diction['invoice_tva']
|
||||
data['invoice_tva'] = invoice_tva
|
||||
|
||||
invoice_condition_paiement_id = ""
|
||||
if ("invoice_condition_paiement_id" in diction.keys()):
|
||||
if diction['invoice_condition_paiement_id']:
|
||||
invoice_condition_paiement_id = diction['invoice_condition_paiement_id']
|
||||
data['invoice_condition_paiement_id'] = invoice_condition_paiement_id
|
||||
|
||||
invoice_adresse = ""
|
||||
if ("invoice_adresse" in diction.keys()):
|
||||
if diction['invoice_adresse']:
|
||||
|
@ -502,7 +508,7 @@ def Update_Partner_Client(diction):
|
|||
"telephone", "website", "comment", "address", "invoice_address", "list_contact",
|
||||
'adr_adresse', 'adr_code_postal', 'adr_ville', 'adr_pays',
|
||||
'invoice_email', 'invoice_nom', 'invoice_siret',
|
||||
'invoice_tva', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_tva','invoice_condition_paiement_id', 'invoice_adresse', 'invoice_ville',
|
||||
'invoice_code_postal', 'invoice_pays', 'client_type_id',
|
||||
'is_fournisseur', 'is_client', 'is_financeur']
|
||||
|
||||
|
@ -705,6 +711,11 @@ def Update_Partner_Client(diction):
|
|||
invoice_tva = diction['invoice_tva']
|
||||
data_update['invoice_tva'] = diction['invoice_tva']
|
||||
|
||||
invoice_condition_paiement_id = ""
|
||||
if ("invoice_condition_paiement_id" in diction.keys()):
|
||||
invoice_condition_paiement_id = diction['invoice_condition_paiement_id']
|
||||
data_update['invoice_condition_paiement_id'] = invoice_condition_paiement_id
|
||||
|
||||
invoice_adresse = ""
|
||||
if ("invoice_adresse" in diction.keys()):
|
||||
invoice_adresse = diction['invoice_adresse']
|
||||
|
@ -1068,6 +1079,17 @@ def Get_Given_Partner_Client(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'invoice_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('invoice_condition_paiement_id' in retval.keys() and retval['invoice_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(retval['invoice_condition_paiement_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['invoice_condition_paiement_code'] = paiement_ction_code
|
||||
|
||||
# Si le client a un 'client_type_id', aller le chercher le code
|
||||
if ("client_type_id" in retval.keys() and retval['retval']):
|
||||
client_type_data = MYSY_GV.dbname['partner_client_type'].find_one(
|
||||
|
@ -1157,6 +1179,17 @@ def Get_Given_Partner_Client_From_Id(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'invoice_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('invoice_condition_paiement_id' in retval.keys() and retval['invoice_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(retval['invoice_condition_paiement_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['invoice_condition_paiement_code'] = paiement_ction_code
|
||||
|
||||
# Si le client a un 'client_type_id', aller le chercher le code
|
||||
if( "client_type_id" in retval.keys() and retval['client_type_id']):
|
||||
client_type_data = MYSY_GV.dbname['partner_client_type'].find_one({'_id':ObjectId(str(retval['client_type_id'])),
|
||||
|
|
|
@ -382,6 +382,19 @@ def Get_Given_Partner_Invoice(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in retval.keys() and retval[
|
||||
'order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_condition_paiement_id'])), 'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if ('order_header_client_id' in retval.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
|
@ -872,6 +885,19 @@ def Get_List_Partner_Invoice_no_filter(diction):
|
|||
#date_jjmmaaa = datetime.strptime(date_jjmmaaa, '%d/%m/%Y')
|
||||
#New_retVal['invoice_date'] = str(date_jjmmaaa)
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in New_retVal.keys() and New_retVal[
|
||||
'order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_condition_paiement_id'])), 'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if( 'order_header_client_id' in New_retVal.keys()):
|
||||
|
@ -1054,6 +1080,20 @@ def Get_List_Partner_Invoice_with_filter(diction):
|
|||
|
||||
if ('partner_invoice_line_collection' in New_retVal.keys() and len( New_retVal['partner_invoice_line_collection']) > 0):
|
||||
user = New_retVal
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in New_retVal.keys() and New_retVal[
|
||||
'order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_condition_paiement_id'])), 'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if ('order_header_client_id' in New_retVal.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
|
|
130
partner_order.py
130
partner_order.py
|
@ -56,7 +56,7 @@ def Add_Partner_Order(diction):
|
|||
field_list = ['token', 'order_header_client_id', 'order_header_description', 'order_header_comment', 'order_header_date_cmd', 'order_header_date_expiration',
|
||||
'order_header_adr_fact_adresse', 'order_header_adr_fact_code_postal', 'order_header_adr_fact_ville','order_header_adr_fact_pays',
|
||||
'order_header_adr_liv_adresse', 'order_header_adr_liv_code_postal', 'order_header_adr_liv_ville', 'order_header_adr_liv_pays',
|
||||
'order_header_condition_paiement', 'order_header_ref_client', 'order_header_vendeur_id', 'order_header_email_client',
|
||||
'order_header_condition_paiement_id', 'order_header_ref_client', 'order_header_vendeur_id', 'order_header_email_client',
|
||||
'order_header_ref_interne', 'order_header_total_ht', 'order_header_total_tax', 'order_header_total_ttc', 'order_header_status', 'order_header_type_reduction',
|
||||
'order_header_type_reduction_valeur', 'order_header_montant_reduction', 'order_lines', 'order_header_type',
|
||||
'order_header_location_type', 'order_header_origin', 'order_header_tax', 'order_header_tax_amount',
|
||||
|
@ -149,17 +149,17 @@ def Add_Partner_Order(diction):
|
|||
return False, " - Le champ 'Commentaire' fait plus de 500 caractères ", False
|
||||
data['order_header_comment'] = diction['order_header_comment']
|
||||
|
||||
order_header_condition_paiement = ""
|
||||
if ("order_header_condition_paiement" in diction.keys()):
|
||||
if diction['order_header_condition_paiement']:
|
||||
order_header_condition_paiement = diction['order_header_condition_paiement']
|
||||
if (len(str(order_header_condition_paiement)) > 255):
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
if diction['order_header_condition_paiement_id']:
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement' fait plus de 255 caractères ")
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères ", False
|
||||
data['order_header_condition_paiement'] = diction['order_header_condition_paiement']
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
order_header_ref_interne = ""
|
||||
if ("order_header_ref_interne" in diction.keys()):
|
||||
|
@ -570,7 +570,7 @@ def Add_Partner_Quotation(diction):
|
|||
'order_header_adr_fact_ville', 'order_header_adr_fact_pays',
|
||||
'order_header_adr_liv_adresse', 'order_header_adr_liv_code_postal', 'order_header_adr_liv_ville',
|
||||
'order_header_adr_liv_pays', 'order_header_email_client',
|
||||
'order_header_condition_paiement', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_condition_paiement_id', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_ref_interne', 'order_header_total_ht', 'order_header_total_tax',
|
||||
'order_header_total_ttc', 'order_header_status', 'order_header_type_reduction',
|
||||
'order_header_type_reduction_valeur', 'order_header_montant_reduction', 'order_lines',
|
||||
|
@ -689,17 +689,17 @@ def Add_Partner_Quotation(diction):
|
|||
return False, " - Le champ 'Commentaire' fait plus de 500 caractères ", False
|
||||
data['order_header_comment'] = diction['order_header_comment']
|
||||
|
||||
order_header_condition_paiement = ""
|
||||
if ("order_header_condition_paiement" in diction.keys()):
|
||||
if diction['order_header_condition_paiement']:
|
||||
order_header_condition_paiement = diction['order_header_condition_paiement']
|
||||
if (len(str(order_header_condition_paiement)) > 255):
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
if diction['order_header_condition_paiement_id']:
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement' fait plus de 255 caractères ")
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères ", False
|
||||
data['order_header_condition_paiement'] = diction['order_header_condition_paiement']
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
order_header_ref_interne = ""
|
||||
if ("order_header_ref_interne" in diction.keys()):
|
||||
|
@ -1077,7 +1077,7 @@ def Update_Partner_Order_Header(diction):
|
|||
'order_header_adr_fact_ville', 'order_header_adr_fact_pays',
|
||||
'order_header_adr_liv_adresse', 'order_header_adr_liv_code_postal', 'order_header_adr_liv_ville',
|
||||
'order_header_adr_liv_pays', 'order_header_email_client',
|
||||
'order_header_condition_paiement', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_condition_paiement_id', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_ref_interne', 'order_header_total_ht', 'order_header_total_tax',
|
||||
'order_header_total_ttc', 'order_header_status', 'order_header_type_reduction',
|
||||
'order_header_type_reduction_valeur', 'order_header_montant_reduction',
|
||||
|
@ -1210,16 +1210,16 @@ def Update_Partner_Order_Header(diction):
|
|||
return False, " - Le champ 'Commentaire' fait plus de 500 caractères "
|
||||
data['order_header_comment'] = diction['order_header_comment']
|
||||
|
||||
order_header_condition_paiement = ""
|
||||
if ("order_header_condition_paiement" in diction.keys()):
|
||||
order_header_condition_paiement = diction['order_header_condition_paiement']
|
||||
if (len(str(order_header_condition_paiement)) > 255):
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement' fait plus de 255 caractères ")
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères "
|
||||
data['order_header_condition_paiement'] = diction['order_header_condition_paiement']
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
order_header_ref_interne = ""
|
||||
if ("order_header_ref_interne" in diction.keys()):
|
||||
|
@ -1541,7 +1541,7 @@ def Update_Partner_Quotation_Header(diction):
|
|||
'order_header_adr_fact_ville', 'order_header_adr_fact_pays',
|
||||
'order_header_adr_liv_adresse', 'order_header_adr_liv_code_postal', 'order_header_adr_liv_ville',
|
||||
'order_header_adr_liv_pays', 'order_header_email_client',
|
||||
'order_header_condition_paiement', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_condition_paiement_id', 'order_header_ref_client', 'order_header_vendeur_id',
|
||||
'order_header_ref_interne', 'order_header_total_ht', 'order_header_total_tax',
|
||||
'order_header_total_ttc', 'order_header_status', 'order_header_type_reduction',
|
||||
'order_header_type_reduction_valeur', 'order_header_montant_reduction',
|
||||
|
@ -1677,16 +1677,16 @@ def Update_Partner_Quotation_Header(diction):
|
|||
return False, " - Le champ 'Commentaire' fait plus de 500 caractères "
|
||||
data['order_header_comment'] = diction['order_header_comment']
|
||||
|
||||
order_header_condition_paiement = ""
|
||||
if ("order_header_condition_paiement" in diction.keys()):
|
||||
order_header_condition_paiement = diction['order_header_condition_paiement']
|
||||
if (len(str(order_header_condition_paiement)) > 255):
|
||||
order_header_condition_paiement_id = ""
|
||||
if ("order_header_condition_paiement_id" in diction.keys()):
|
||||
order_header_condition_paiement_id = diction['order_header_condition_paiement_id']
|
||||
if (len(str(order_header_condition_paiement_id)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " - Le champ 'order_header_condition_paiement' fait plus de 255 caractères ")
|
||||
|
||||
return False, " - Le champ 'Condition de paiement' fait plus de 255 caractères "
|
||||
data['order_header_condition_paiement'] = diction['order_header_condition_paiement']
|
||||
data['order_header_condition_paiement_id'] = diction['order_header_condition_paiement_id']
|
||||
|
||||
order_header_ref_interne = ""
|
||||
if ("order_header_ref_interne" in diction.keys()):
|
||||
|
@ -2903,17 +2903,35 @@ def Get_Given_Partner_Order(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in retval.keys() and retval['order_header_condition_paiement_id'] ):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_condition_paiement_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
print(" #### paiement_ction_code = ", paiement_ction_code)
|
||||
print(" #### retval['order_header_condition_paiement_id'] = ", retval['order_header_condition_paiement_id'])
|
||||
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if ('order_header_client_id' in retval.keys()):
|
||||
order_header_client_nom = ""
|
||||
if ('order_header_client_id' in retval.keys() and retval['order_header_client_id']):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (Client_data and 'nom' in Client_data.keys()):
|
||||
user['order_header_client_nom'] = str(Client_data['nom'])
|
||||
order_header_client_nom = str(Client_data['nom'])
|
||||
user['order_header_client_nom'] = order_header_client_nom
|
||||
|
||||
|
||||
# Si le champ 'order_header_vendeur_id' alors on va chercher le nom et prenom du vendeur (employe)
|
||||
if ('order_header_vendeur_id' in retval.keys()):
|
||||
order_header_vendeur_nom_prenom = ""
|
||||
if ('order_header_vendeur_id' in retval.keys() and retval['order_header_vendeur_id']):
|
||||
Employee_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_vendeur_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
|
@ -2926,7 +2944,9 @@ def Get_Given_Partner_Order(diction):
|
|||
order_header_vendeur_nom_prenom = str(order_header_vendeur_nom_prenom) + " " + str(
|
||||
Employee_data['prenom'])
|
||||
|
||||
user['order_header_vendeur_nom_prenom'] = str(order_header_vendeur_nom_prenom)
|
||||
order_header_vendeur_nom_prenom = str(order_header_vendeur_nom_prenom)
|
||||
|
||||
user['order_header_vendeur_nom_prenom'] = order_header_vendeur_nom_prenom
|
||||
|
||||
# Recuperation des ligne associées
|
||||
retval_line_data = []
|
||||
|
@ -3375,17 +3395,32 @@ def Get_Given_Partner_Order_From_Internal_ref(diction):
|
|||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in retval.keys() and retval['order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_condition_paiement_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if ('order_header_client_id' in retval.keys()):
|
||||
order_header_client_nom = ""
|
||||
if ('order_header_client_id' in retval.keys() and retval['order_header_client_id']):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_client_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (Client_data and 'nom' in Client_data.keys()):
|
||||
user['order_header_client_nom'] = str(Client_data['nom'])
|
||||
order_header_client_nom = str(Client_data['nom'])
|
||||
user['order_header_client_nom'] = order_header_client_nom
|
||||
|
||||
# Si le champ 'order_header_vendeur_id' alors on va chercher le nom et prenom du vendeur (employe)
|
||||
if ('order_header_vendeur_id' in retval.keys()):
|
||||
order_header_vendeur_nom_prenom = ""
|
||||
if ('order_header_vendeur_id' in retval.keys() and retval['order_header_vendeur_id']):
|
||||
Employee_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retval['order_header_vendeur_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
|
@ -3398,7 +3433,9 @@ def Get_Given_Partner_Order_From_Internal_ref(diction):
|
|||
order_header_vendeur_nom_prenom = str(order_header_vendeur_nom_prenom) + " " + str(
|
||||
Employee_data['prenom'])
|
||||
|
||||
user['order_header_vendeur_nom_prenom'] = str(order_header_vendeur_nom_prenom)
|
||||
order_header_vendeur_nom_prenom = str(order_header_vendeur_nom_prenom)
|
||||
|
||||
user['order_header_vendeur_nom_prenom'] = order_header_vendeur_nom_prenom
|
||||
|
||||
# Recuperation des ligne associées
|
||||
retval_line_data = []
|
||||
|
@ -3491,6 +3528,17 @@ def Get_List_Partner_Order_no_filter(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in New_retVal.keys() and New_retVal['order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_condition_paiement_id'])), 'valide': '1', 'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if( 'order_header_client_id' in New_retVal.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one({'_id':ObjectId(str(New_retVal['order_header_client_id'])), 'valide':'1', 'locked':'0',
|
||||
|
@ -3664,6 +3712,20 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
for New_retVal in MYSY_GV.dbname['partner_order_header'].aggregate(new_myquery_find_order):
|
||||
if ('partner_order_line_collection' in New_retVal.keys() and len( New_retVal['partner_order_line_collection']) > 0):
|
||||
user = New_retVal
|
||||
|
||||
# Si le champ 'order_header_condition_paiement_id' alors on va chercher le code de la condition de paiement
|
||||
paiement_ction_code = ""
|
||||
if ('order_header_condition_paiement_id' in New_retVal.keys() and New_retVal[
|
||||
'order_header_condition_paiement_id']):
|
||||
paiement_ction_data = MYSY_GV.dbname['base_partner_paiement_condition'].find_one(
|
||||
{'_id': ObjectId(str(New_retVal['order_header_condition_paiement_id'])), 'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (paiement_ction_data and 'code' in paiement_ction_data.keys()):
|
||||
paiement_ction_code = str(paiement_ction_data['code'])
|
||||
user['order_header_paiement_condition_code'] = paiement_ction_code
|
||||
|
||||
# Si le champ 'order_header_client_id' alors on va chercher le nom du client
|
||||
if ('order_header_client_id' in New_retVal.keys()):
|
||||
Client_data = MYSY_GV.dbname['partner_client'].find_one(
|
||||
|
|
Loading…
Reference in New Issue