Add Tradon processes help menu
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
account,
|
account,
|
||||||
purchase,
|
purchase,
|
||||||
sale,
|
sale,
|
||||||
global_reporting,
|
global_reporting,
|
||||||
@@ -32,11 +32,15 @@ from . import (
|
|||||||
dimension,
|
dimension,
|
||||||
weight_report,
|
weight_report,
|
||||||
backtoback,
|
backtoback,
|
||||||
service,
|
service,
|
||||||
invoice,
|
invoice,
|
||||||
)
|
routes,
|
||||||
|
)
|
||||||
def register():
|
|
||||||
|
__all__ = ['register', 'routes']
|
||||||
|
|
||||||
|
|
||||||
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
association_tables.LCDocumentTypeProductProfile,
|
association_tables.LCDocumentTypeProductProfile,
|
||||||
association_tables.LCLetterDocumentType,
|
association_tables.LCLetterDocumentType,
|
||||||
|
|||||||
24
modules/purchase_trade/process_documentation.xml
Normal file
24
modules/purchase_trade/process_documentation.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
<record model="ir.action.url" id="url_tradon_processes">
|
||||||
|
<field name="name">Tradon Processes</field>
|
||||||
|
<field name="url">%(http_host)s/%(database)s/purchase_trade/processes</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
name="Help & Processes"
|
||||||
|
sequence="95"
|
||||||
|
icon="tryton-public"
|
||||||
|
id="menu_help_processes"/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
name="Tradon Processes"
|
||||||
|
parent="menu_help_processes"
|
||||||
|
action="url_tradon_processes"
|
||||||
|
sequence="10"
|
||||||
|
id="menu_tradon_processes"/>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 01. Integrite et valeurs ethiques
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment l'organisation demontre son engagement envers l'integrite et
|
||||||
|
les valeurs ethiques.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# 02. Supervision par la gouvernance
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment la gouvernance exerce sa responsabilite de supervision.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 03. Structure, autorite et responsabilites
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les structures, lignes d'autorite et responsabilites sont
|
||||||
|
definies pour atteindre les objectifs de controle interne.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 04. Competences
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment l'organisation attire, developpe et retient les competences
|
||||||
|
necessaires.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 05. Responsabilisation
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les acteurs sont tenus responsables de leurs obligations de
|
||||||
|
controle interne.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 06. Definition des objectifs
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les objectifs sont definis avec assez de clarte pour permettre
|
||||||
|
l'identification et l'evaluation des risques.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 07. Identification et analyse des risques
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les risques sont identifies et analyses pour determiner leur
|
||||||
|
mode de traitement.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 08. Risque de fraude
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment le risque de fraude est pris en compte dans l'evaluation des
|
||||||
|
risques.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 09. Changements importants
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les changements importants susceptibles d'affecter le controle
|
||||||
|
interne sont identifies et evalues.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 10. Controles repondant aux risques
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les activites de controle sont selectionnees et developpees
|
||||||
|
pour ramener les risques a un niveau acceptable.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 11. Controles generaux informatiques
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les controles generaux informatiques soutiennent la realisation
|
||||||
|
des objectifs de controle interne.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 12. Regles et procedures
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les activites de controle sont deployees au travers de regles
|
||||||
|
et procedures.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 13. Information pertinente
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment l'organisation obtient ou produit une information pertinente et
|
||||||
|
de qualite pour soutenir le controle interne.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 14. Communication interne
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les informations necessaires au controle interne sont
|
||||||
|
communiquees en interne.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 15. Communication externe
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les informations pertinentes sont communiquees aux parties
|
||||||
|
externes lorsque cela est necessaire.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 16. Evaluations continues ou ponctuelles
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment des evaluations continues ou ponctuelles permettent de verifier
|
||||||
|
que les composantes du controle interne sont presentes et fonctionnent.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 17. Communication des deficiences
|
||||||
|
|
||||||
|
## Objectif COSO
|
||||||
|
|
||||||
|
Decrire comment les deficiences de controle interne sont identifiees et
|
||||||
|
communiquees aux responsables concernes.
|
||||||
|
|
||||||
|
## Application dans TradOn / Tryton
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Processus purchase_trade concerne
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Controles realises
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Ecrans, modeles et champs Tryton concernes
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Preuves attendues
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
## Points ouverts
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
44
modules/purchase_trade/process_documentation/README.md
Normal file
44
modules/purchase_trade/process_documentation/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Purchase Trade - Documentation des processus COSO
|
||||||
|
|
||||||
|
Ce dossier sert d'aide documentaire pour decrire les processus du module
|
||||||
|
`purchase_trade` selon la structure du framework COSO.
|
||||||
|
|
||||||
|
L'index ci-dessous suit l'ordre classique des 5 composantes COSO et de leurs
|
||||||
|
17 principes. Chaque lien pointe vers un fichier Markdown dedie au processus ou
|
||||||
|
sous-processus correspondant.
|
||||||
|
|
||||||
|
## Index des processus
|
||||||
|
|
||||||
|
| Ordre | Composante COSO | Processus / sous-processus | Documentation |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 01 | Environnement de controle | Integrite et valeurs ethiques | [Ouvrir](01_environnement_de_controle/01_integrite_valeurs_ethiques.md) |
|
||||||
|
| 02 | Environnement de controle | Supervision par la gouvernance | [Ouvrir](01_environnement_de_controle/02_supervision_gouvernance.md) |
|
||||||
|
| 03 | Environnement de controle | Structure, autorite et responsabilites | [Ouvrir](01_environnement_de_controle/03_structure_autorite_responsabilites.md) |
|
||||||
|
| 04 | Environnement de controle | Competences | [Ouvrir](01_environnement_de_controle/04_competences.md) |
|
||||||
|
| 05 | Environnement de controle | Responsabilisation | [Ouvrir](01_environnement_de_controle/05_responsabilisation.md) |
|
||||||
|
| 06 | Evaluation des risques | Definition des objectifs | [Ouvrir](02_evaluation_des_risques/06_definition_objectifs.md) |
|
||||||
|
| 07 | Evaluation des risques | Identification et analyse des risques | [Ouvrir](02_evaluation_des_risques/07_identification_analyse_risques.md) |
|
||||||
|
| 08 | Evaluation des risques | Risque de fraude | [Ouvrir](02_evaluation_des_risques/08_risque_fraude.md) |
|
||||||
|
| 09 | Evaluation des risques | Changements importants | [Ouvrir](02_evaluation_des_risques/09_changements_importants.md) |
|
||||||
|
| 10 | Activites de controle | Controles repondant aux risques | [Ouvrir](03_activites_de_controle/10_controles_reponse_risques.md) |
|
||||||
|
| 11 | Activites de controle | Controles generaux informatiques | [Ouvrir](03_activites_de_controle/11_controles_generaux_informatiques.md) |
|
||||||
|
| 12 | Activites de controle | Regles et procedures | [Ouvrir](03_activites_de_controle/12_regles_procedures.md) |
|
||||||
|
| 13 | Information et communication | Information pertinente | [Ouvrir](04_information_communication/13_information_pertinente.md) |
|
||||||
|
| 14 | Information et communication | Communication interne | [Ouvrir](04_information_communication/14_communication_interne.md) |
|
||||||
|
| 15 | Information et communication | Communication externe | [Ouvrir](04_information_communication/15_communication_externe.md) |
|
||||||
|
| 16 | Pilotage | Evaluations continues ou ponctuelles | [Ouvrir](05_pilotage/16_evaluations.md) |
|
||||||
|
| 17 | Pilotage | Communication des deficiences | [Ouvrir](05_pilotage/17_communication_deficiences.md) |
|
||||||
|
|
||||||
|
## Structure conseillee de chaque fiche
|
||||||
|
|
||||||
|
Chaque fichier de processus peut suivre la structure suivante:
|
||||||
|
|
||||||
|
- objectif COSO;
|
||||||
|
- application dans TradOn / Tryton;
|
||||||
|
- processus metier `purchase_trade` concerne;
|
||||||
|
- roles et responsabilites;
|
||||||
|
- controles realises;
|
||||||
|
- ecrans, modeles et champs Tryton concernes;
|
||||||
|
- preuves attendues;
|
||||||
|
- points ouverts ou ameliorations possibles.
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Image Assets
|
||||||
|
|
||||||
|
This folder contains images used by the process documentation Markdown files.
|
||||||
|
|
||||||
|
Recommended formats:
|
||||||
|
|
||||||
|
- `.png` for screenshots and diagrams;
|
||||||
|
- `.svg` for simple vector diagrams;
|
||||||
|
- `.jpg` for photos.
|
||||||
|
|
||||||
235
modules/purchase_trade/routes.py
Normal file
235
modules/purchase_trade/routes.py
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
# this repository contains the full copyright notices and license terms.
|
||||||
|
import html
|
||||||
|
import mimetypes
|
||||||
|
import os
|
||||||
|
import posixpath
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
from urllib.parse import quote, unquote
|
||||||
|
|
||||||
|
from trytond.protocols.wrappers import (
|
||||||
|
HTTPStatus, Response, abort, send_file, with_pool, with_transaction)
|
||||||
|
from trytond.wsgi import app
|
||||||
|
|
||||||
|
|
||||||
|
DOCUMENTATION_ROOT = Path(__file__).with_name('process_documentation')
|
||||||
|
MARKDOWN_LINK = re.compile(r'(!?)\[([^\]]*)\]\(([^)]+)\)')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/<database_name>/purchase_trade/processes', methods={'GET'})
|
||||||
|
@app.route(
|
||||||
|
'/<database_name>/purchase_trade/processes/<path:filename>',
|
||||||
|
methods={'GET'})
|
||||||
|
@app.auth_required
|
||||||
|
@with_pool
|
||||||
|
@with_transaction(user='request', context=dict(_check_access=True))
|
||||||
|
def process_documentation(request, pool, filename='README.md'):
|
||||||
|
target = _documentation_path(filename)
|
||||||
|
if not target.exists() or not target.is_file():
|
||||||
|
abort(HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
if target.suffix.lower() == '.md':
|
||||||
|
relative_name = _relative_name(target)
|
||||||
|
markdown = target.read_text(encoding='utf-8')
|
||||||
|
content = _markdown_to_html(markdown, relative_name, pool.database_name)
|
||||||
|
return Response(content, content_type='text/html; charset=utf-8')
|
||||||
|
|
||||||
|
mimetype = mimetypes.guess_type(str(target))[0]
|
||||||
|
return send_file(
|
||||||
|
str(target), request.environ, mimetype=mimetype,
|
||||||
|
download_name=target.name)
|
||||||
|
|
||||||
|
|
||||||
|
def _documentation_path(filename):
|
||||||
|
filename = unquote(filename or 'README.md').replace('\\', '/')
|
||||||
|
filename = posixpath.normpath(filename).lstrip('/')
|
||||||
|
if filename in {'.', ''}:
|
||||||
|
filename = 'README.md'
|
||||||
|
if filename.startswith('../'):
|
||||||
|
abort(HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
root = DOCUMENTATION_ROOT.resolve()
|
||||||
|
target = (root / Path(*filename.split('/'))).resolve()
|
||||||
|
common_path = os.path.commonpath([str(root), str(target)])
|
||||||
|
if target != root and common_path != str(root):
|
||||||
|
abort(HTTPStatus.NOT_FOUND)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def _relative_name(path):
|
||||||
|
return path.relative_to(DOCUMENTATION_ROOT.resolve()).as_posix()
|
||||||
|
|
||||||
|
|
||||||
|
def _documentation_url(database_name, filename):
|
||||||
|
filename = posixpath.normpath(filename).lstrip('/')
|
||||||
|
return '/%s/purchase_trade/processes/%s' % (
|
||||||
|
quote(database_name), quote(filename, safe='/'))
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_link(current_file, target):
|
||||||
|
if target.startswith(('#', 'http://', 'https://', 'mailto:')):
|
||||||
|
return target
|
||||||
|
current_dir = posixpath.dirname(current_file)
|
||||||
|
return posixpath.normpath(posixpath.join(current_dir, target)).lstrip('/')
|
||||||
|
|
||||||
|
|
||||||
|
def _inline(markdown, current_file, database_name):
|
||||||
|
parts = []
|
||||||
|
last = 0
|
||||||
|
for match in MARKDOWN_LINK.finditer(markdown):
|
||||||
|
parts.append(html.escape(markdown[last:match.start()]))
|
||||||
|
is_image, label, target = match.groups()
|
||||||
|
resolved = _resolve_link(current_file, target)
|
||||||
|
url = target if resolved == target and target.startswith(
|
||||||
|
('#', 'http://', 'https://', 'mailto:')) else _documentation_url(
|
||||||
|
database_name, resolved)
|
||||||
|
label = html.escape(label)
|
||||||
|
url = html.escape(url, quote=True)
|
||||||
|
if is_image:
|
||||||
|
parts.append('<img src="%s" alt="%s"/>' % (url, label))
|
||||||
|
else:
|
||||||
|
parts.append('<a href="%s">%s</a>' % (url, label))
|
||||||
|
last = match.end()
|
||||||
|
parts.append(html.escape(markdown[last:]))
|
||||||
|
return ''.join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
def _markdown_to_html(markdown, current_file, database_name):
|
||||||
|
body = []
|
||||||
|
table = []
|
||||||
|
in_list = False
|
||||||
|
|
||||||
|
def close_list():
|
||||||
|
nonlocal in_list
|
||||||
|
if in_list:
|
||||||
|
body.append('</ul>')
|
||||||
|
in_list = False
|
||||||
|
|
||||||
|
def flush_table():
|
||||||
|
nonlocal table
|
||||||
|
if table:
|
||||||
|
close_list()
|
||||||
|
body.append(_render_table(table, current_file, database_name))
|
||||||
|
table = []
|
||||||
|
|
||||||
|
for line in markdown.splitlines():
|
||||||
|
stripped = line.strip()
|
||||||
|
if stripped.startswith('|') and stripped.endswith('|'):
|
||||||
|
table.append(stripped)
|
||||||
|
continue
|
||||||
|
|
||||||
|
flush_table()
|
||||||
|
if not stripped:
|
||||||
|
close_list()
|
||||||
|
continue
|
||||||
|
|
||||||
|
if stripped.startswith('#'):
|
||||||
|
close_list()
|
||||||
|
level = len(stripped) - len(stripped.lstrip('#'))
|
||||||
|
level = min(level, 6)
|
||||||
|
title = stripped[level:].strip()
|
||||||
|
body.append('<h%d>%s</h%d>' % (
|
||||||
|
level, _inline(title, current_file, database_name), level))
|
||||||
|
elif stripped.startswith('- '):
|
||||||
|
if not in_list:
|
||||||
|
body.append('<ul>')
|
||||||
|
in_list = True
|
||||||
|
body.append('<li>%s</li>' % _inline(
|
||||||
|
stripped[2:].strip(), current_file, database_name))
|
||||||
|
else:
|
||||||
|
close_list()
|
||||||
|
body.append('<p>%s</p>' % _inline(
|
||||||
|
stripped, current_file, database_name))
|
||||||
|
|
||||||
|
flush_table()
|
||||||
|
close_list()
|
||||||
|
|
||||||
|
back_link = ''
|
||||||
|
if current_file != 'README.md':
|
||||||
|
back_link = '<p><a href="%s">Back to index</a></p>' % html.escape(
|
||||||
|
_documentation_url(database_name, 'README.md'), quote=True)
|
||||||
|
return HTML_TEMPLATE % {
|
||||||
|
'title': html.escape('Tradon Processes'),
|
||||||
|
'back_link': back_link,
|
||||||
|
'body': '\n'.join(body),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _render_table(lines, current_file, database_name):
|
||||||
|
rows = [
|
||||||
|
[cell.strip() for cell in line.strip('|').split('|')]
|
||||||
|
for line in lines
|
||||||
|
]
|
||||||
|
header = rows[0] if rows else []
|
||||||
|
data = rows[1:]
|
||||||
|
if data and all(set(cell) <= {'-', ':'} for cell in data[0]):
|
||||||
|
data = data[1:]
|
||||||
|
|
||||||
|
output = ['<table>', '<thead><tr>']
|
||||||
|
for cell in header:
|
||||||
|
output.append('<th>%s</th>' % _inline(
|
||||||
|
cell, current_file, database_name))
|
||||||
|
output.append('</tr></thead><tbody>')
|
||||||
|
for row in data:
|
||||||
|
output.append('<tr>')
|
||||||
|
for cell in row:
|
||||||
|
output.append('<td>%s</td>' % _inline(
|
||||||
|
cell, current_file, database_name))
|
||||||
|
output.append('</tr>')
|
||||||
|
output.append('</tbody></table>')
|
||||||
|
return ''.join(output)
|
||||||
|
|
||||||
|
|
||||||
|
HTML_TEMPLATE = '''<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<title>%(title)s</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
color: #1f2933;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
padding: 32px;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
max-width: 1120px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #0b63ce;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 16px 0;
|
||||||
|
width: 100%%;
|
||||||
|
}
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid #d7dde5;
|
||||||
|
padding: 8px 10px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: #f3f6f9;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
%(back_link)s
|
||||||
|
%(body)s
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
'''
|
||||||
@@ -31,7 +31,8 @@ xml:
|
|||||||
global_reporting.xml
|
global_reporting.xml
|
||||||
derivative.xml
|
derivative.xml
|
||||||
valuation.xml
|
valuation.xml
|
||||||
weight_report.xml
|
weight_report.xml
|
||||||
dimension.xml
|
dimension.xml
|
||||||
backtoback.xml
|
backtoback.xml
|
||||||
account.xml
|
account.xml
|
||||||
|
process_documentation.xml
|
||||||
|
|||||||
Reference in New Issue
Block a user